Symfony Best Practices recommends that you do not use packages for organizing business logic.
Bundles should only be used when the code in them is intended to be reused as is in other applications:
But the bundle must be something that can be reused by the autonomous piece of software. If the UserBundle cannot be used "as is" in other Symfony applications, then this should not be its own package.
So, when I upgrade my application from Symfony 3.3 to Symfony 4, I think that this is the right time to reorganize my code.
At the moment, I have been following the "ligament-structure":
- src - AppBundle - Controller - Entity - Repository - Resources - ... - MyNamespace - Bundle - BundleTodo - Controller - Entity - Repository - Resources - ... - BundleCatalog - Controller - Entity - Repository - Resources - ... - BundleCart - Controller - Entity - Repository - Resources - ... - ...
Now, with the new directory structure, how do I organize the code?
I would like to organize it like this:
-src - Core - Controller - Entity - Repository - .. - Todos - Controller - Entity - Repository - .. - Catalog - Controller - Entity - Repository - .. - Cart - Controller - Entity - Repository - ...
But is that right? Are there any problems with the expected folder structure of Symfony 4 and Flex?
Or something better like this:
-src - Controller - Core - Todos - Catalog - Cart - ... - Entity - Core - Todos - Catalog - Cart - ... - Repository - Core - Todos - Catalog - Cart - ... - ...
The same applies to other root folders, as described in the project directory structure (how to redefine it).
Are there any rules or restrictions that I should consider when choosing my new folder structure?
THE FIRST SOLVING THE PROBLEM
So, trying to solve the problem, I will go deeper in the documentation, and I will write here what I will find.