Symfony official documentation says:
"Don't Create any Bundle to Organize your Application Logic"
https://symfony.com/doc/current/best_practices.html
And:
In Symfony versions prior to 4.0, it was recommended to organize your own application code using bundles. This is no longer recommended and bundles should only be used to share code and features between multiple applications.
https://symfony.com/doc/current/bundles.html
Lets assume that I have 10 modules in my app: "Company Module", "User Module", "Accounting Module", etc.
Bundles(Modules) are not separate Composer packages; instead, they are committed as part of the app code, and each Bundle(Module) is included in config/bundles.php.
Each module is created as a bundle with its own configuration, and the average size of each configuration is around 100 lines.
For example each of this file have in average 100 lines of code:
Module\[MODULE_NAME]\Resource\config\services.yaml
Also some of the modules(bundles) have routes config:
Module\[MODULE_NAME]\Resource\config\routes.yaml
Some of them workflow config:
Module\[MODULE_NAME]\Resource\config\workflow.yaml
etc.
And that is perfectly fine by me. I want to put module configuration inside each module folder, not in config folder in the root (config/services.yaml).
What is alternative? Put everything from each module configuration.yaml to config/services.yaml and have messy file with 1000 lines of configuration?
Or put configuration inside each module (which is not bundle) and then import it with inside config/services.yaml with:
imports:
- { resource: Module\[MODULE_NAME]\Resource\config\services.yaml }
- { resource: Module\[MODULE_NAME2]\Resource\config\services.yaml }
- { resource: Module\[MODULE_NAME3]\Resource\config\services.yaml }
...
That is also a little bit messy for me.
When I need to use templates within a module that isn't a bundle, I have to place the templates inside a 'templates' folder at the root.
templates/MODULE_NAME
templates/MODULE_NAME2
templates/MODULE_NAME3
...
This is already the third instance where I repeatedly find myself creating ten folders for each module. There are additional situations, such as translations, where this approach should also be applied, potentially leading to more than 10 instances where this task needs to be performed in the same manner.
Isn't it easier to create a module as a bundle and keep all its components inside that bundle, rather than creating ten folders for each bundle in multiple locations?
I am perfectly happy when "UserModule" code is only in folder for "UserModule" not everywhere around.
What is a general concern of creating a modules as bundles?