samburns/dirty-needle
最新稳定版本:3.0.3
Composer 安装命令:
composer require samburns/dirty-needle
包简介
Dependency Injection container for PHP
README 文档
README
dirty-needle
Introduction
Dependency Injection container for PHP
Set up a config file which returns a PHP array, like this:
<?php return array( 'dirty-needle' => array( '@dependency' => array( 'class' => '\Dependency' ), '@class-with-dependency' => array( 'class' => '\ClassWithDependency', 'arguments' => array( '@dependency' ) ), ), );
Then get stuff out of your container, like this:
$diContainer = \DirtyNeedle\DiContainer()::getInstance(); $diContainer->addConfigFile('/path/to/config.php'); $classWithDependency = $diContainer->get('class-with-dependency');
You can also do inject mock objects:
$diContainer->set('service-id', $mockObject);
Reseting definitions and mocks:
$diContainer->reset();
Releases are available supporting PHP5.3-5.6, with the 5.6-compatible releases being significantly faster in their implementation.
Versioning
The project uses semantic versioning.
统计信息
- 总下载量: 92
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-15