Repository presents Symfony project with multiple kernel approach.
Symfony Multiple Kernels allows you create many independent Kernels. Thanks to that you can: manage the bundles you use and separate configuration for every kernel.
Let's assume your project has two parts:
apiadmin
And just only for admin version you need to use Twig which is useless for api part. To achieve this you have to create two instances of AppKernel:
Those two classes extend from AppKernel. This way you can get separate bundle list for each kernel.
To separate configuration, sessions, caches and logs you need overwrite AppKernel.php methods;
app/
├── .htaccess
├── AdminKernel.php
├── ApiKernel.php
├── AppCache.php
├── AppKernel.php
├── KernelFactory.php
├── Resources
│ └── views
├── autoload.php
└── config
├── admin
└── api
var/cache/
├── .gitkeep
├── admin
│ └── dev
└── api
└── dev
var/sessions/
├── .gitkeep
├── admin
│ └── dev
└── api
└── dev
var/logs
├── .gitkeep
├── admin
│ ├── dev.log
│ └── prod.log
└── api
├── dev.log
└── prod.log
Separate parameters require custom parameters builder, and replacement in composer.json.
This action can be handle by exporting APP_NAME env like SYMFONY_ENV or by adding -a admin or --app-name=admin command's options. e.g. bin/console --app-name=admin