akuma / distribution-bundle
v1.0.4
2017-06-25 10:52 UTC
Requires
- php: >=5.4
- symfony/symfony: >=2.8.0
This package is auto-updated.
Last update: 2024-09-05 23:25:57 UTC
README
实现了一种额外的方式,可以在不更新应用程序文件的情况下加载包。
使用方法
通过扩展 (extends AkumaKernel) 从 Akuma\Bundle\DistributionBundle\AkumaKernel
修改应用程序的当前内核,并确保合并父级结果,如下所示
class AppKernel extends AkumaKernel { public function registerBundles() { $bundles = array( ... ); if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { ... } //Following should be replaced to suport list of bundles from AkumaKernel return parent::registerBundles($bundles); }
将 Resources/config/bundle.yml 文件添加到您希望应用程序内核自动注册的每个包中
bundle: class: 'Acme\Bundle\TestBundle\AcmeTestBundle' priority: -1 kernel: true environment: ['test', 'prod'] require: - {class: 'Acme\Bundle\OtherBundle\AcmeOtherBundle', kernel: true}
其中
class
- 是Bundle
的主类priority
- 是一个整数值kernel
- 表示包类是否需要将内核对象作为构造函数的参数environment
- 需要加载包的环境名称数组require
- 需要加载的包数组
命令
列出已注册的包
命令语法是 akuma:debug:bundle
。显示应用程序中所有已注册的包。