1

I just got to know about ADR (Action Domain Responder) pattern that seems to be much more efficient than MVC (Model View Controller), but as oppose to MVC, I have it difficult to find a framework for ADR. The reason must be its age, it is so young. But still does anyone knows a PHP(or any other languages) framework that implements ADR?

1

Symfony 2 is not really a MVC based framework. A controller can be any callable; so you can use it for ADR.

Some links explaining how use controllers as actions:

It could also be a good idea to use controllers to instantiate and parameterize your actions; so an action don't have to know if it was asked from an HTTP request or console command, for example.

  • Well I do not know symfony, so I ask a few questions. 1- What about responses? The controller generates the response, or it is dealth with in a separate class? 2- Also is each action a totally separate class? – Musa Haidari Oct 7 '15 at 10:07
  • 1. By default, if your controller returns a string, a new response will be created and your string used as the body. But, yes, the controller can instantiate itself the response object or ask for it to the responder. 2. It's a common practice, in Symfony, to group actions in a controller, but, as I said, a controller can be any callable so it can have only one method, and this method can be "__invoke" so the controller is callable itself, and usable as an action. – Lionel Gaillard Oct 7 '15 at 10:25
  • Well so if I am correct, we can mention laravel here too – Musa Haidari Oct 7 '15 at 12:09
  • Yes we can. But, IMHO, Laravel's target is small to medium applications and it is very much "CRUD oriented". With Laravel, you can quickly create small CRUD API, but it seriously lack of robustness for bigger applications (I'm experiencing this right now), especially with Eloquent (Laravel's ORM). Since you're interested in the ADR pattern, I suppose you consider a big application since the ADR pattern is almost useless for smallest applications. – Lionel Gaillard Oct 7 '15 at 13:05
  • In summary, Symfony has some common practice and default choices, but it will never block you to create your own ways. At the opposite, Laravel is very "opinionated"; it allows you to develop quickly when you follow already designed ways, but it will be very difficult to go out of the way. And ADR is clearly not a common way. – Lionel Gaillard Oct 7 '15 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.