motana/multikernel
Composer 安装命令:
composer require motana/multikernel
包简介
Motana Multi-Kernel Bundle
关键字:
README 文档
README
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.
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.
Since the BootKernel is a modified Symfony Kernel with almost all features disabled, the penalty of having a prefixed extra kernel is rather small.
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:
$ composer require motana/multikernel
in a shell.
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:
// 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:
$ 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:
- 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.
The command makes the following changes to each app kernel to make it work in a multikernel environment:
- 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/:
- 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:
$ composer dump-autoload
Configuration
The following settings can be used in apps/config/config.yml to configure the BootKernel:
# 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:
Change the KERNEL_CLASS setting to BootKernel
<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.
Credits
Portions of this bundle are based on work of Fabien Potencier <fabien@symfony.com> and Jean-François Simon <contact@jfsimon.fr>.
License
This bundle is licensed under the MIT license - see the LICENSE file for details.
motana/multikernel 适用场景与选型建议
motana/multikernel 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 06 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「kernel」 「multi-kernel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 motana/multikernel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 motana/multikernel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 motana/multikernel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SDK kernel for php
The bundle for easy using json-rpc api on your project
淘宝 SDK 封装, 调用简单、语义化增强。支持 Laravel/Lumen。
PhpPlaisio: Kernel
Bundle Symfony DaplosBundle
Pollen Solutions - Kernel Component - Basic tools for building a web application based on the Pollen Solutions component suite.
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-13