We all agree that methods and function should do one thing only. We call this Single Responsibility Principle.
However, the fact that methods sho...
For further actions, you may consider blocking this person and/or reporting abuse
I’ve never did this before... but I do agree that Controllers should be kept lean.
What specific benefits have you found in this pattern? I’m assuming easier debugging but can’t see performance benefits and in my opinion it’s not better developer experience compared to several controllers with a handful of methods that are common to a resource or domain.
You'll place all related controllers in the same namespace (App\Http\Controllers\Users{Register,Invite, ...}UserController.php)
As indicated in this article, it adheres more closely to the single responsibility principle, that a given class should only do a specific thing.
Personally, I'm leaning more and more towards ADR where a single method controller ties in perfectly.
I highly recommend looking into ADR more, and see for yourself where the advantages lie for your project.
I have used single method controller once in a symfony project, and I've got to admit that it's indeed much more clear/easy to read !
Good write up!
I read about this technique before - have to admit I didn't use it yet, as I think I'll end up needing more functions from the controller and thus editing everything back.
methods !== functions
Sounds totally nice to me, I will try it in my next project!
I think what you are naturally looking for is the command/handler pattern to encapsulate use cases.