acvos/bubbles
最新稳定版本:1.0.1
Composer 安装命令:
composer require acvos/bubbles
包简介
Bubbles DI Container
README 文档
README
Minimalistic, extensible, lazy dependency injection container.
Why?
It's always good to follow best practices even when you don't use a full-stack framework. If you are writing a small, focused back-end service or script, but still want the full power of DI, Bubbles would help turning your plain old PHP classes into injectable services.
How?
Installation
composer require acvos/bubbles
Usage
// Instantiating Bubbles facade $bubbles = new Acvos\Bubbles\ContainerManager(); // Obtaining new DI container $container = $bubbles->spawn(); // Configuring dependencies $container ->register('zzz', 200) ->register('test.service', 'Acvos\Bubbles\Example\TestService') ->addDependency('Setter injection example', 'bob') ->addDependency('@zzz', 'bar') ->addDependency(100, 'foo') ->register('test.another.service', 'Acvos\Bubbles\Example\TestService') ->addDependency('@test.service') ->addDependency('zzz'); // Getting our class instance as a DI service $service = $container->get('test.another.service');
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-13