aztech/event-dispatcher
Composer 安装命令:
composer require aztech/event-dispatcher
包简介
Aztech Event Dispatcher
README 文档
README
Build status
Stability
License
This library is released under the MIT license. Please see attached LICENSE file.
Installation
Via Composer
Composer is the only supported way of installing aztech/event-dispatcher . Don't know Composer yet ? Read more about it.
$ composer require "aztech/event-dispatcher":"~1"
Autoloading
Add the following code to your bootstrap file :
require_once 'vendor/autoload.php';
Usage
As the name implies, event-dispatcher is a simple event dispatching library. Rather than a long speech, a simple example :
class MyEvent implements \Aztech\Events\Event { function getCategory() { return 'my.event'; } function getId() { return 1; } } $dispatcher = new \Aztech\Events\EventDispatcher(); $subscriber = new \Aztech\Events\Callback(function (\Aztech\Events\Event $event) { echo 'I just received an event : ' . $event->getCategory() . PHP_EOL; }); $dispatcher->addListener('my.#', $subscriber); $dispatcher->dispatch(new MyEvent());
Contributing
All contributions are welcome, via issues and pull requests.
When submitting a pull request, please ensure that your changes validate against the test suite and style checkers by running make test. All tests must pass (make must return 0).
统计信息
- 总下载量: 1.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-08-15