scabbiafw/scabbia2-services
最新稳定版本:v0.1.2
Composer 安装命令:
composer require scabbiafw/scabbia2-services
包简介
Scabbia2 Services Component
README 文档
README
This component is a tiny dependency management container implementation allow you to share, produce and access instances/variables easily.
Usage
Basic Key/Value Container
use Scabbia\Services; $container = new Services(); $container['key'] = 'value'; echo $container['key'];
Singleton Access
use Scabbia\Services; $container = Services::getCurrent(); $container['key'] = ['sample', 'array']; var_dump($container['key']);
Setting a Factory
use Scabbia\Services; $container = Services::getCurrent(); $container->setFactory('key', function () { return ['time' => microtime(true)]; }); var_dump($container['key']); var_dump($container['key']); // will be different than previous one
Decorating
use Scabbia\Services; $container = Services::getCurrent(); $container['key'] = 'test'; $container->decorate('key', function ($value) { return $value . 'ing'; }); $container->decorate('key', function ($value) { return strtoupper($value); }); var_dump($container['key']); // returns 'TESTING'
Links
Contributing
It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome. All contributions should be filed on the eserozvataf/scabbia2-services repository.
统计信息
- 总下载量: 142
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-09-15