symfony-realworld-example-app
symfony-realworld-example-app copied to clipboard
[Question] about project best practices
Hello @slashfan 👋, I really appreciate your work, it's very qualitative, it allowed me to deepen my knowledge with Symfony and especially learn how to build a solid API.
I noted some questions about the good practices you used during the development of this project. I would be really grateful if you can enlighten me on some points, it will certainly be very useful for the followers of this project even for those how wanna contribute.
-
Why you prefer not to using the AbstractController proposed by the framework, instead of injecting all the services one by one under your controller consutruct. I feel that the answer is related to a good practice but I do not really see why!
-
What's the point of adding the final key, on services, controllers, subscribers ?
-
Does there is a convention used for renaming your controllers, for example often you use this format
<Get|Create|Delete..><Entity>Controller.phplikeGetArticleController.phpand sometimes you just use<some string>Controller.phplikeSecurityController.php -
I wonder why you prefer having only one function per controller and not more. Is there a use behind this design !
-
Is there a rule or an RFC for renaming paths when defining routes. For example if you have a route responsible for exporting any article, do I should call it
/api/article/1.pdfor/api/article/export.pdf? -
Is there a rule for renaming services, it is better to suffix them by
ServiceorHandleror nothing. What about having one function per a service like you did inside the controllers ? -
Instead of using the form component via
$form->submit() + form types, why you didn't use the Denormelizers to retrieve your data and populate it in your entity for POST, PUT and PATCH methods and then you collect validations errors like it's mentioned here ? -
What is the difference between
EventListenerandEventSubscriber, what is the most recommended for use and why you did putJWTAuthenticationSubscriber.phpinEventSubscriberinstead of putting it inEventLisetner? -
I see Rector, PHPstan or PHPslam, or PHPmd ? what is the difference are they all a statics analyzers tools !
I look forward to your response. Thank you so mush 🙏. Cheers!