Search code examples
phpsymfonybundlesymfony-2.3

Symfony own vendor bundle dependencies


So I have created my own vendor bundle that will essesntially contain our "in-house" framework which will be required by all our application using composer.

I have followed this guide: Symfony2 - creating own vendor bundle - project and git strategy

But my "in-house" framework bundle has a dependency on another bundle and that bundle needs to be registered into the app kernel.

Below is my reusable framework bundle which every app we develop will require. But the app framework bundle needs to register 3rd party bundles such as Predis and redis-bundle.

Anyway I can register those bundle so the app that requires this vendor package doesnt have to include all the framework dependency bundles in it's own AppKernel.php file? Maybe the has it's own AppKernel file that "tacks" on the dependencies?

MyCompany/
├─ AppFrameworkBundle.php
├─ Controller/
├─ README.md
├─ LICENSE
├─ Resources/
│   ├─ config/
│   │  └─ config.yml <- this and other 3rd party bundle configuration
│   ├─ doc/
│   │  └─ index.rst
│   ├─ translations/
│   ├─ views/
│   └─ public/
└─ Tests/

Sorry if the explanation is a bit vague.

Kind Regards


Solution

  • The answer is yes. You will not find the answer inside the Symfony Core, but there is the Symfony Bundle Dependencies package that just covers this need.

    In all my projects I'm using it, not because makes me cooler, but because I want to really respect the integrity of all my bundles, and without this library, my bundles have not integrity at all (it sounds like when Symfony was at 2.0 with deps files, instead of going on top of composer)

    ATM, no other option.