Description
While the AppBundle concept is already a big improvement, it's still a bundle. I have done some digging and I hope I've come up with a solution.
What is the AppBundle good for?
- Registering of compiler passes, can add some application specific features
- Prepend configuration of other bundles
- Adding (annotated 3.2+) classes to compile
- Manipulating the container
What additional stuff does it do under the hood?
Provides a basic entry point for:
- Bundle Alias (Used most often when calling controllers, templates and entities)
- Register Commands
- Provide a default location for things like Doctrine
- Annotation routes
- All based on the namespace and file location of the bundle
- Assetics
What features does it have that are useless to applications as AppBundle?
- Registering an extension point for Configurations
- The container Extension class (unless you prepend) is useless because you can already load everything in your kernel and you can load a whole directory of service/config files now
- boot/shutdown/build methods are useless as they can all be in the kernel
- getParent is not needed
My personal use-case
- I use controller as a service (no alias required)
- I use command as a service (no registerCommands required)
- I have Entities in packages outside of the App(Bundle) so I don't need the default doctrine behavior
- I don't use Assetics (no alias required)
- My templates are in
app/Resources/views
so I don't need the alias for templates either - I have annotated routes but I can use a path relative to my kernel dir for this
- I do manipulate the container but all of those can be in the kernel as well when building the container
- Registering several compiler passes
- I prepend some config
- I add classes to compile
Of course this is based on my needs, but could be expanded on. Doctrine for example allows you to configure your AppBundle manually as well. If you look at it like this, the whole AppBundle concept is actually overhead, but it requires quite a bit more effort to get it to work using just the Kernel.
When looking at the list, there's only 3 things my application really needs from the bundle: Classes to compile, compiler passes and prepending extension config. I would like to add an extension point for those 3 points in the kernel (4 if you count the new 3.2 annotated class cache) to make it easier to use a bundle-less setup of Symfony.
Is this something people are interested in? Did I forget any cases? Should Symfony provide a default "fake bundle" entry point in a directory and namespace of your choosing, e.g. registering a virtual bundle?