Giter VIP home page Giter VIP logo

symfony-multiple-kernels's Introduction

Symfony Multiple Kernels

Repository presents Symfony project with multiple kernel approach.

Multiple Kernels

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.

Introduction

Let's assume your project has two parts:

  • api
  • admin

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.

Configs, Sessions, Caches & Logs

To separate configuration, sessions, caches and logs you need overwrite 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

Separate parameters require 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

symfony-multiple-kernels's People

Contributors

dominikhajduk avatar partikus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.