2017 © Pedro PelĂĄez
 

symfony-bundle multikernel

Motana Multi-Kernel Bundle

image

motana/multikernel

Motana Multi-Kernel Bundle

  • Saturday, December 23, 2017
  • by KintradimCrux
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 24 Versions
  • 0 % Grown

The README.md

MotanaMultikernelBundle

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License composer.lock, (*1)

This bundle extends a Symfony3 project by the ability to use multiple apps in the same project directory, all running with the same front controller and bin/console., (*2)

Routing within the apps will work as usual, which means already existing routes will continue to work. Each app will be made available with its kernel name as URL prefix by the front controller. The bin/console replacement is able to run commands like cache:clear, cache:pool:clear and assets:install for all apps in one run, which will make the SensioDistributionBundle run those commands for all apps when running composer install or composer update., (*3)

Since the BootKernel is a modified Symfony Kernel with almost all features disabled, the penalty of having a prefixed extra kernel is rather small., (*4)

Installation

Step 1: Download the bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*5)

$ composer require motana/multikernel

in a shell., (*6)

Step 2: Enable the bundle

Enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project. Make sure it is registered after the SensioGeneratorBundle:, (*7)


// app/AppKernel.php // ... class AppKernel extends Kernel { // ... public function registerBundles() { // ... $bundles[] = new Motana\Bundle\MultikernelBundle\MotanaMultikernelBundle(); return $bundles; } // ... }

Step 3: Use the commands of the bundle to convert your project

Open a command console, enter your project directory and execute the following command to convert your project:, (*8)

$ bin/console multikernel:convert

How the filesystem structure is changed

Running the multikernel:convert command will make the following changes to the filesystem structure of the project:, (*9)

  • A boot kernel skeleton will be created into the apps/ subdirectory of your project
  • All found apps will be copied to apps/<DIR_NAME>
  • The kernel of every app will be modified to run with the BootKernel
  • Configuration of the apps are modified to reflect the filesystem structure changes
  • The front controller and bin/console are replaced

After all modifications have taken place, the original app directories and also all files and directories under var/cache/, var/logs and var/sessions are removed., (*10)

The command makes the following changes to each app kernel to make it work in a multikernel environment:, (*11)

  • Use clauses are replaced to use classes from the MotanaMultikernelBundle
  • The methods getCacheDir(), getLogDir() and registerContainerConfiguration() are removed

The command changes the configuration of each app for a changed directory scheme under var/:, (*12)

  • Caches for each kernel are stored in var/cache/<KERNEL_NAME>/<ENVIRONMENT_NAME>/
  • Logs for each kernel are stored in var/logs/<KERNEL_NAME>/<ENVIRONMENT_NAME>.log
  • Sessions for each kernel are stored in var/sessions/<KERNEL_NAME>/

After running the multikernel:convert command, run the following commands on a shell:, (*13)

    $ composer dump-autoload

Configuration

The following settings can be used in apps/config/config.yml to configure the BootKernel:, (*14)

# Default configuration for "MotanaMultikernelBundle"
motana_multikernel:

    # Default kernel the front controller should load when no kernel matches the URL
    default:              null # Example: "app" for the default AppKernel

    # Class cache configuration
    class_cache:

        # Classes to exclude from being cached in classes.php of app kernels
        exclude:              []

    # Console commands configuration
    commands:

        # Commands to add as multi-kernel command, bypassing the requirement of being available for all kernels
        add:                  []

        # Commands that will always be run on the boot kernel and will be hidden in the other kernels
        global:               []

        # Commands that will be hidden in all kernels
        hidden:               []

        # Commands that will be left as-is, overriding all of the above command settings
        ignore:               []

Testing your project

To reflect the changes in the filesystem structure and routing, your phpunit.xml needs to be updated as follows:, (*15)

Change the KERNEL_CLASS setting to BootKernel, (*16)


<server name="KERNEL_CLASS" value="BootKernel" />

To select a kernel in your tests extending Symfony\Bundle\FrameworkBundle\Test\WebTestCase simply prefix the kernel name to the URL used in the test., (*17)

Credits

Portions of this bundle are based on work of Fabien Potencier <fabien@symfony.com> and Jean-François Simon <contact@jfsimon.fr>., (*18)

License

This bundle is licensed under the MIT license - see the LICENSE file for details., (*19)

The Versions

22/06 2017

1.2.4

1.2.4.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

symfony kernel multi-kernel

22/06 2017

1.2.3

1.2.3.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

symfony kernel multi-kernel

21/06 2017

1.2.2

1.2.2.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

symfony kernel multi-kernel

21/06 2017

1.2.1

1.2.1.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

symfony kernel multi-kernel

21/06 2017

1.2.0

1.2.0.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

symfony kernel multi-kernel

19/06 2017

1.1.0

1.1.0.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

symfony kernel multi-kernel

14/06 2017

1.0.3

1.0.3.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

kernel multi multi-kernel

13/06 2017

1.0.2

1.0.2.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

kernel multi multi-kernel

13/06 2017

1.0.1

1.0.1.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

kernel multi multi-kernel

13/06 2017

1.0

1.0.0.0 http://github.com/KintradimCrux/motana-multikernel/

Motana Multi-Kernel Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Wenzel Jonas

kernel multi multi-kernel