gonzalo123/new
Composer 安装命令:
composer require gonzalo123/new
包简介
Creating new instances auto injecting dependencies from a Pimple Container
README 文档
README
Creating new instances auto injecting dependencies from a DIC
class Foo { public function hi($name) { return "Hi $name"; } } class Another { public function bye($name) { return "Bye $name"; } } class Bar { private $foo; public function __construct(Foo $foo, $surname = null) { $this->foo = $foo; $this->surname = $surname; } public function hi(Another $another, $name) { return $this->foo->hi($name . " " . $this->surname) . ' ' . $another->bye($name); } } $container = new Pimple\Container (); $container['name'] = "Gonzalo2"; $builder = new G\Builder($container); /** @var Bar $bar */ $bar = $builder->create('Bar', ['surname' => 'Ayuso']); var_dump($builder->call([$bar, 'hi'])); var_dump($bar->hi(new Another(), 'xxxxx'));
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-10