Download the PHP package berenger/adr-bundle without Composer
On this page you can find all versions of the php package berenger/adr-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download berenger/adr-bundle
More information about berenger/adr-bundle
Files in berenger/adr-bundle
Package adr-bundle
Short Description This bundle simplifies the setup of the ADR in a Symfony project.
License MIT
Homepage https://github.com/berenger/AdrBundle
Informations about the package adr-bundle
ADR Bundle
Action–domain–responder (ADR) is a software architectural pattern that was proposed by Paul M. Jones[1] as a refinement of Model–view–controller (MVC) that is better suited for web applications. ADR was devised to match the request-response flow of HTTP communications more closely than MVC, which was originally designed for desktop software applications.
from Wikipedia
This bundle simplifies the setup of the ADR in a Symfony 5.0 project.
Versions
- 1.x version (stable version) : Recommended for all projects using Symfony 3.4.
- 2.x version (stable version) : Recommended for all projects using Symfony 4.4.
- 3.x version (stable version) : Recommended for all projects using Symfony 5.0 or newer.
Prerequisites
- PHP : version 7.2 minimum
- Symfony : version 5.0 minimum
Installation
Add the bundle to your project
Add Cor identifier
Use in the reponse's header : Access-Control-Allow-Origin
update the file : config/service.yaml
Add bundle to config
update the file : config/bundles.php
Symfony : Services are private by default
update the file : config/service.yaml
Usage
Routing
Action (Controller)
The action must return an associative array that will be pass to the responder __invoke
method.
Each key of the array must match an argument of the responder __invoke
method signature,
otherwise an exception will be thrown. The order of the arguments in the array is not important.
Responder
The responder can either:
- directly return an instance of
Symfony\Component\HttpFoundation\Response
(e.g. when you return a response containing HTML generated with Twig) - an array of data to be serialized in the response (mostly the case when you're building an API that returns Json or XML). In that case you can specify serialization groups.