ellipse/resolvable-callable
Composer 安装命令:
composer require ellipse/resolvable-callable
包简介
Resolvable callable factory allowing to execute callables using a Psr-11 container
README 文档
README
This package provides a resolvable callable factory allowing to execute callables using a Psr-11 container.
Require php >= 7.0
Installation composer require ellipse/resolvable-callable
Run tests ./vendor/bin/kahlan
Resolve a callable
This package provides a factory producing instances of Ellipse\Resolvable\ResolvableCallable from callables. Those resolvable callable values can then be produced by calling the ->value() method with a Psr-11 container and an array of placeholder values.
<?php namespace App; use Some\Psr11Container; use Ellipse\Resolvable\DefaultResolvableCallableFactory; // The callable to resolve. $callable = function (SomeClass $p1, int $p2 = 0, int $p3, string $p4 = 'p4') { // $p1 is the instance returned by $container->get(SomeClass::class); // $p2 value is 2 // $p3 value is 3 // $p3 value is 'p4' return 'result'; }; // Some Psr-11 container. $container = new Psr11Container; // Resolve the callable. $resolved value is 'result'. $factory = new DefaultResolvableCallableFactory; $resolved = $factory($callable)->value($container, [2, 3]);
统计信息
- 总下载量: 191
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-05