tomcizek/symfony-interop-container
Composer 安装命令:
composer require tomcizek/symfony-interop-container
包简介
Symfony Interop Container which has config array under 'config' key - for Extensions using Interoperability Factories.
README 文档
README
This bundle is handy when you want to create symfony vendor bundle that uses interoperability factories with interop config.
Why bother?
It registers 'interop_container' service for you, which has same services as default 'service_container', plus it returns app config array under key 'config'. This config is something you need to define in your extension.
Quick start
1) Install this library through composer
composer require tomcizek/symfony-interop-container
2) Register SymfonyInteropContainerBundle in your kernel
3) Create your Bundle with Extension and register in kernel too, for example:
class TestExtension extends AbstractInteropExtension { public function load(array $configs, ContainerBuilder $containerBuilder) { // parent call is mandatory, or it will not work as expected! parent::load($configs, $containerBuilder); // we can set another config key (default is extension alias: $this->getAlias()) $this->configBuilder->setKey('test'); // we can merge over another config $this->configBuilder->mergeOverByConfig([]); // we can merge over multiple configs $this->configBuilder->mergeOverByConfigs([[]]); // we can merge default config $this->configBuilder->mergeDefaultConfig([]); // if you want, you can build config by: $config = $this->configBuilder->build(); // it will be built in process method and injected into interop_container service } public function process(ContainerBuilder $containerBuilder) { // If you need to redefine process method, parent call is mandatory. parent::process($containerBuilder); } }
Contribute
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.
统计信息
- 总下载量: 107
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-09