No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 3 commits behind partikus:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bin
src
tests/AppBundle/Controller
var
web
.gitignore
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

Symfony Multiple Kernels

Use Symfony with multiple kernel approach.

Multiple Kernels

Symfony Multiple Kernels approach allows you create many independent Kernels. Thanks do that you can control list of enabled bundles as you wish.

Introduction

Let's assume our project has two parts:

  • api
  • admin

And just only for admin version you need to use Twig. To solve this issue we have to create two instances of AppKernel:

Those two classes extend from AppKernel. Thanks to that per each kernel you could have two indepentent list of bundles.

Configs, Sessions, Caches & Logs

These issues have been resolved by overriding AppKernel.php methods;

New directory structure

app

app/
├── .htaccess
├── AdminKernel.php
├── ApiKernel.php
├── AppCache.php
├── AppKernel.php
├── KernelFactory.php
├── Resources
│   └── views
├── autoload.php
└── config
    ├── admin
    └── api

cache

var/cache/
├── .gitkeep
├── admin
│   └── dev
└── api
    └── dev

sessions

var/sessions/
├── .gitkeep
├── admin
│   └── dev
└── api
    └── dev

logs

var/logs
├── .gitkeep
├── admin
│   ├── dev.log
│   └── prod.log
└── api
    ├── dev.log
    └── prod.log

Multiple parameters.yml

This issue has been resolved by adding custom parameters builder; And replacement in composer.json

Switch between Multiple App Kernels

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