I'm wondering how's the best way to work with Symfony2 when you have several projects sharing common bundles.

In my case, all bundles are private and will continue being, and each project will be in different servers.For instance:

api.project.com frontend.project.com backend.project.com

The three project have their own bundles, and a others in common. In my case, the CoreBundle contains the model and business logic.Our team has 4 members, and all of us will be continuously updating it.

a) All in the same project. One app.php and AppKernel.php. In the routing.yml, we specify routes with subdomains per each project.The AppKernel loads all bundles always. Problem: Unnecessary bundles loading.

d) Each bundle with his own repository. Each project install the common bundles using git submodules in the src folder

e) All commond bundles in the same repository. Each project, through symlinks, include the bundles he needs.

f) Use Satis to share the bundles between the projects. Bundles will be installed with composer in vendor/companyName folder.Each time a user modifies a common bundle, he must go inside the bundle folder (to access to its git repository), and make the git push

Let me start by pointing out that I never actually implemented something like that, so this is off the top of my head.

I think the problem is: do your 3 projects share the same DB or not? If they don't, just split them in 3 independent projects, and you're good to go. If they do share the same DBs, however, I wouldn't recommend this, as I don't know what can happen when you mix multiple doctrine instances and their caches over the same DB.

I'd go with option A. Yes, there's an overhead associated with loading unnecessary bundles, but if you take into account Symfony's cache and APC, you'll see that it's not that significant. Besides, you can separate you code in several bundles on the same instance, making you project modular yet simple to maintain (no need to update config.yml or run composer update 3 times). IMO, simplicity tops performance, as it's usually cheaper to upgrade a server than find a fix a bug that results from weird interactions between 3 kernels running on the same project and sharing some obscure resource or config parameter.

i had a domain exampleA.com and a domain exampleB.com that were both running different themes but the same backendi then made app_domainA.php and app_domainB.php and call them from the corresponding domain.Because my themes are in bundles i decided to modify the appkernel and check the environment like this: