I'm currently building a fairly large Symfony 2 application with a number of ever increasing bundles that I'm struggling to keep count of.
I try to keep all bundles specific to each module of the system, which has provided me with a nice easy to manage structure. What isn't so nice is my app/config/config.yml
that's very quickly grown out of control. Understand imports can be done within this file which have helped me somewhat but I'd like to move a whole range of config specific to each bundle which should help to keep these bundles reusable within our other applications.
Here of some examples of what I'd like to move to individual bundles.
1) Dependency Injection
We use JMSDiExtraBundle within all internal bundles as we find it makes developing a little bit quicker and easier to manage.
# Annotations/Config
jms_di_extra:
locations:
bundles:
- AppBundle
- BlogBundle
- ContentBundle
- StoreBundle
- UserBundle
I'd like this block to be moved to each individuals bundle config.yml
or better yet this would be enabled in each bundles DependencyInjection/AppBundleExtension.php
.
2) Routing
Use for route config, but each bundle still needs including within app/config/routing.yml
leaving us with a pretty large unmanageable file.
Some examples
app:
resource: "@AppBundle/Controller"
type: annotation
blog:
resource: "@BlogBundle/Controller"
type: annotation
content:
resource: "@ContentBundle/Controller"
type: annotation
oneup_uploader:
resource: .
type: uploader
3) OneUp Uploader
This is my biggest biting point, this configuration is over 500 lines long currently between the 20+ bundles we use. Here are some examples pulled from app/config/uploader.yml
which is imported from config.yml
. If I could somehow get these into each bundles config I'd be very happy!
# Uploader
oneup_uploader:
mappings:
bundle_name_reference1:
frontend: blueimp
storage:
type: gaufrette
filesystem: gaufrette.local_filesystem
bundle_name_reference2:
frontend: blueimp
storage:
type: gaufrette
filesystem: gaufrette.local_filesystem
My thoughts are by getting all these configs into each individual bundle, I can enable/disable them really easily by just updating AppKernel.php
. I'm assuming all of this is possible as Symfony is incredibly flexible, I'm just a little lost when it comes to these lower level alterations.