All Projects → narration → Narration

narration / Narration

Licence: mit
The Narration PHP Framework - Empowering everyone to build reliable and loosely coupled web apps.

Projects that are alternatives of or similar to Narration

Gearbox
Gearbox ⚙️ is a web framework written in Go with a focus on high performance
Stars: ✭ 455 (+282.35%)
Mutual labels:  api, rest, framework
Api Platform
Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.
Stars: ✭ 7,144 (+5903.36%)
Mutual labels:  api, rest, framework
Zerocode
A community-developed, free, open source, microservices API automation and load testing framework built using JUnit core runners for Http REST, SOAP, Security, Database, Kafka and much more. Zerocode Open Source enables you to create, change, orchestrate and maintain your automated test cases declaratively with absolute ease.
Stars: ✭ 482 (+305.04%)
Mutual labels:  api, rest, framework
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+2797.48%)
Mutual labels:  api, rest, application
Psx
PHP REST API Framework
Stars: ✭ 108 (-9.24%)
Mutual labels:  api, rest, framework
Horse
Fast, opinionated, minimalist web framework for Delphi
Stars: ✭ 295 (+147.9%)
Mutual labels:  api, rest, framework
Goyave
🍐 Elegant Golang REST API Framework
Stars: ✭ 811 (+581.51%)
Mutual labels:  api, rest, framework
Fastapi Crudrouter
A dynamic FastAPI router that automatically creates CRUD routes for your models
Stars: ✭ 159 (+33.61%)
Mutual labels:  api, rest, framework
Yarf
Yet Another REST Framework
Stars: ✭ 62 (-47.9%)
Mutual labels:  api, rest, framework
Rest Control
Framework for testing and validation REST services
Stars: ✭ 51 (-57.14%)
Mutual labels:  api, rest, framework
Ray
a framework that helps you to deliver well-designed python APIs
Stars: ✭ 215 (+80.67%)
Mutual labels:  api, rest, framework
Dreamfactory
DreamFactory API Management Platform
Stars: ✭ 1,148 (+864.71%)
Mutual labels:  api, rest, framework
Magic
Create your .Net Core/Angular/Database CRUD Web apps by simply clicking a button
Stars: ✭ 214 (+79.83%)
Mutual labels:  api, rest, framework
Loopback Next
LoopBack makes it easy to build modern API applications that require complex integrations.
Stars: ✭ 3,972 (+3237.82%)
Mutual labels:  api, rest, framework
Mono
Minimalist Framework on top of Express.js
Stars: ✭ 163 (+36.97%)
Mutual labels:  api, rest, framework
Deno Drash
A REST microframework for Deno's HTTP server with zero 3rd party dependencies.
Stars: ✭ 795 (+568.07%)
Mutual labels:  api, rest, framework
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+33167.23%)
Mutual labels:  api, rest, framework
Falcon
The no-nonsense REST API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
Stars: ✭ 8,654 (+7172.27%)
Mutual labels:  api, rest, framework
Foal
Elegant and all-inclusive Node.Js web framework based on TypeScript. 🚀.
Stars: ✭ 1,176 (+888.24%)
Mutual labels:  api, rest, framework
Wechat Go
go version wechat web api and message framework for building wechat robot
Stars: ✭ 1,381 (+1060.5%)
Mutual labels:  api, framework

THIS PACKAGE HASN'T BEEN RELEASED, DO NOT USE YET

Build Status Quality Score Total Downloads Latest Version License

This is a work in progress.

Narration is the source for modern PHP - It enforces the implementation of proven patterns to bring resilience, reliability, and coordination to your web application.

Philosophies

  • DDD oriented code architecture
  • Zero coupling to the framework
  • Strong PHPStan rules to ensure the quality of the code
  • For Scalable PSR-7 and PSR-15 compliant REST services.

Quick start

Requires PHP 7.1.3+

Create your project using Composer:

composer create-project narration/narration blog --stability=dev --prefer-source

Then, serve the appplication at http://127.0.0.1:8000/:

php -S 127.0.0.1:8000 serve.php

Structure

Application

The application logic is where you implement all use cases that depend on a given front end. It delegates the execution of business rules to the domain layer. Keep this layer thin.

Application > Http > Request Handlers

HTTP request handlers are a fundamental part of any web application. Server-side code receives a request message, processes it, and produces a response message:

final class Index
{
    /**
     * Handle the given request.
     *
     * @param  \Psr\Http\Message\ServerRequestInterface $request
     *
     * @return array
     */
    public function __invoke(ServerRequestInterface $request): array
    {
        return [
            'quote' => 'Intellectuals solve problems, geniuses prevent them.',
        ];
    }
}

Request handlers should be placed at Appplication/Http/RequestHandlers. The routes are defined within the config/routes/http.php file.

This convention leads code that is easier to maintain, refactor and test.

Application > Http > Middleware

An HTTP middleware component participates in processing an HTTP message. It acts on the request, generating the response, or forwarding the request to a subsequent middleware and possibly acting on its response. It provides a convenient mechanism for filtering HTTP requests entering your application:

final class TrimStrings implements MiddlewareInterface
{
    /**
     * Filters the given request before or after sending it to the handler.
     *
     * @param  \Psr\Http\Message\ServerRequestInterface $request
     * @param  \Psr\Http\Server\RequestHandlerInterface $handler
     *
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        foreach ($request->getAttributes() as $name => $value) {
            if (is_string($value)) {
                $request = $request->withAttribute($name, trim($value));
            }
        }

        return $handler->handle($request);
    }
}

The middleware are defined within the config/routes/http.php file.

Application > Injectors

We provide a simple, yet powerful, IOC container. The framework doesn’t couple you to our container, feel free to swap to another PSR-11 implementation on the ‘config/container.php’ file.

The container is used by the default PSR-7 router of the framework to inject the necessary dependencies on the request handlers.

An injector injects the dependencies of the application on the container. They should be placed at Appplication/Injectors.

Injectors are defined within the config/container.php file.

Domain

Responsible for representing concepts of the business rules. This layer is the heart of business software.

Infrastructure

The infrastructure layer is how the data that is initially held in domain entities (in memory) is persisted in databases or another persistent store. An example is using Doctrine code to implement the Repository pattern classes that use Entities to persist data in a relational database.

Contributing

Thank you for considering to contribute to Narration. All the contribution guidelines are mentioned here.

You can have a look at the CHANGELOG for constant updates & detailed information about the changes. You can also follow the twitter account for latest announcements or just come say hi!: @enunomaduro

Support the development

Do you like this project? Support it by donating

Credits

Lot of this readme is based on Design a DDD-oriented microservice by Microsoft.

License

Narration is an open-sourced software licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].