Search code examples
symfonyarchitecturecode-organizationproject-organizationsymfony4

Symfony 4. Code organization


My question is next - how you organize code-base of your application when it have a lot of complex code?

I start learn Symfony 4 framework. Before I developed applications using Yii 1.1 and Yii 2 frameworks. In projects that was built around this frameworks code divided by modules for better organization and maintenance. This way of code organization is encouraged on all forums dedicated for Yii frameworks.

In Symfony world closest analog of Yii modules is bundles. As I understand, after reading related articles and docs, they really was used for such code organization, but they were developed not exactly for this purpose. For Symfony 4 authors recommend build bundle-less applications and at this point I really confused.

Search for answers on my questing give me nothing. Some advice to group classes under namespaces (sub folders) in controllers, templates, entities, etc, but I feel that this is not a right way since views, controllers, services and other classes will be scattered across project.

I know that one right answer for this question does not exist, but anyway I curious about how this problem is solved in Symfony world.


Solution

  • Nothing is stopping you from just ignoring the current official recommendation and splitting your web app into multiple Flex Bundles. That's what I'd do because as it stands now, what they are recommending is essentially an antipattern.