承接 peridot-php/event-emitter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

peridot-php/event-emitter

Composer 安装命令:

composer require peridot-php/event-emitter

包简介

EventEmitter is a very simple event dispatching library for PHP

README 文档

README

EventEmitter is a very simple event dispatching library for PHP. It is a fork of Événement aiming to provide additional functionality and PHP 5.6 features like variadic arguments.

It is very strongly inspired by the EventEmitter API found in node.js.

Build Status

Fetch

The recommended way to install EventEmitter is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "peridot/event-emitter": "2.0.*"
    }
}

And run these two commands to install it:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

Now you can add the autoloader, and you will have access to the library:

<?php
require 'vendor/autoload.php';

Usage

Creating an Emitter

<?php
$emitter = new Peridot\EventEmitter();

Adding Listeners

<?php
$emitter->on('user.created', function (User $user) use ($logger) {
    $logger->log(sprintf("User '%s' was created.", $user->getLogin()));
});

Emitting Events

<?php
$emitter->emit('user.created', $user);

Tests

$ vendor/bin/phpunit

License

MIT, see LICENSE.

统计信息

  • 总下载量: 728
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 8
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 4
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-18