phug/dependency-injection
最新稳定版本:1.13.0
Composer 安装命令:
composer require phug/dependency-injection
包简介
Phug dependency injection engine
关键字:
README 文档
README
What is Phug Dependency Injection?
This project allow to provide helpers functions and values, to require them and to dump all required dependencies as a PHP array export.
Installation
Install via Composer
composer require phug/dependency-injection
Usage
use Phug\DependencyInjection; $dependencies = new DependencyInjection(); $dependencies->register('limit', 42); $dependencies->provider('clock', static function () { return new Clock(); }); $dependencies->provider('expiration', ['clock', 'limit', static function (ClockInterface $clock, $limit) { return static function ($margin) use ($clock, $limit) { $delta = $limit - $margin; return $clock->now()->modify("$delta days"); }; }]); $expiration = $dependencies->call('expiration'); // return new DateTimeImmutable('now + 42 days') $expiration = $dependencies->call('expiration', 20); // return new DateTimeImmutable('now + 22 days')
Security contact information
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
统计信息
- 总下载量: 90.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-12