kerasai/container-aware
Composer 安装命令:
composer require kerasai/container-aware
包简介
Tooling inject container into services.
README 文档
README
This package adds utilities for making code "container aware".
Usage
To build a service container and automatically inject the container to all container aware services:
<?php use Kerasai\ContainerAware\ContainerAwareCompilerPass; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; $containerBuilder = new ContainerBuilder(); $loader = new YamlFileLoader($containerBuilder, new FileLocator(__DIR__)); $loader->load('services.yml'); $containerBuilder->addCompilerPass(new ContainerAwareCompilerPass()); $containerBuilder->compile();
And on your services, implement the
\Symfony\Component\DependencyInjection\ContainerAwareInterface interface.
Also use \Symfony\Component\DependencyInjection\ContainerAwareTrait to easily
implement the interface.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-04-20