Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Joey Masip Romeu:
Namespaces and organizing business logic services in Symfony
Dec 08, 2017 @ 17:04:35

In a post on his Medium site Joey Masip Romeu shares some suggestions about how you can organize your business logic in a Symfony application with some simple namespacing and service definitions.

I want to talk about namespacing services in Symfony, specifically Symfony3.

These are exciting times, Symfony 4 is just round the corner?— -coming out on November 30th? - ?so this blog post might be irrelevant soon! Nevertheless, concepts are still the same so let´s get into it!

He offers three "rules" that he and his team at SlowCode have defined to help with their own organization:

  • using a folder for logic services
  • using a folder for the domain name
  • using . for folder separation and _ for word separation

Code and configuration examples are provided for each suggestion helping to illustrate the point. He ends the post mentioning public and private services and how they're changing in upcoming Symfony releases.

tagged: namespace organize business logic symfony rule domain

Link: https://medium.com/@joeymasip/namespaces-and-organizing-business-logic-services-in-symfony-d80452adc4f7


Trending Topics: