Symfony2 multiple config and routing files for subdomain routing

烈酒焚心 提交于 2019-12-04 14:03:52

I had the same need so we did like this:

/apps/config
/apps/config/common_config.yml
/apps/config/common_routing.yml
/apps/config/...

/apps/myapp1
/apps/myapp1/myapp1Kernel.php
/apps/myapp1/...
/apps/myapp1/config
/apps/myapp1/config/config.yml
/apps/myapp1/config/routing.yml
/apps/myapp1/config/...

/apps/myapp2
/apps/myapp2/myapp1Kernel.php
/apps/myapp2/...
/apps/myapp2/config
/apps/myapp2/config/config.yml
/apps/myapp2/config/routing.yml
/apps/myapp2/config/...

...

And in each app's yml file, we had:

/apps/myapp1/config/config.yml

imports:
    - { resource: "../../config/common_config.yml" }

And then, you have to reproduce the same way in /web

/web/myapp1/app.php

Who will be calling your app

$kernel = new myapp1Kernel('prod', false);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!