Symfony3使用多个AppKernel.php

Symfony3使用多个AppKernel.php

问题描述:

I run with 3 sites with the same app on Symfony2, all of these sites have a custom AppKernel.php file. I'm now upgrading to Symfony3 and it seem that the composer.json including by default the file "app/AppKernel.php" and "app/AppCache.php". I would like to provide app/AppKernel.php for site A and apps/siteB/app/AppKernel.php for site B. How can i set a custom AppKernel location?

我在Symfony2上运行3个具有相同应用程序的站点,所有这些站点都有自定义的AppKernel.php文件。 我现在升级到Symfony3,似乎composer.json默认包含文件“app / AppKernel.php”和“app / AppCache.php”。 我想为站点A提供app / AppKernel.php,为站点B提供apps / siteB / app / AppKernel.php。如何设置自定义AppKernel位置? p> div>

I see three easy solutions for you:

  1. Remove the autoload entries for the AppKernel and AppCache class from the composer.json file.

  2. Use different namespaces for each kernel class, change the autoload configuration to be able to load all of them and use the right namespace when creating and booting the kernel.

  3. Similar to 2.: Do not add namespaces but use different class names for the different kernels.