davedevelopment/pimple-aware-event-dispatcher
Composer 安装命令:
composer require davedevelopment/pimple-aware-event-dispatcher
包简介
A Symfony compatible event dispatcher that allows services to be lazy loaded from an instance of the Pimple DI container
README 文档
README
Installation
composer.phar require "davedevelopment/pimple-aware-event-dispatcher:*@dev"
Usage
To use in a Silex application:
<?php use PimpleAwareEventDispatcher\PimpleAwareEventDispatcher; use Silex\Application; use Symfony\Component\EventDispatcher\EventDispatcher; $app = new Application; // define the dispatcher $app['event_dispatcher'] = function () use ($app) { $dispatcher = new EventDispatcher(); return new PimpleAwareEventDispatcher($dispatcher, $app); }; // define our application services $app['some.service'] = function() use ($app) { // let's assume this takes a bit of doing and/or is dependant on several other // services sleep(1); return new SomeService; }; // add a listener, that will lazily fetch the service when needed $app['event_dispatcher']->addListenerService( "some.event", array("some.service", "serviceMethod") );
统计信息
- 总下载量: 2.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2012-10-08