2017 © Pedro PelĂĄez
 

library event-emitter

EventEmitter is a very simple event dispatching library for PHP

image

peridot-php/event-emitter

EventEmitter is a very simple event dispatching library for PHP

  • Saturday, April 18, 2015
  • by brianium
  • Repository
  • 5 Watchers
  • 4 Stars
  • 209 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

EventEmitter

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., (*1)

It is very strongly inspired by the EventEmitter API found in node.js., (*2)

Build Status, (*3)

Fetch

The recommended way to install EventEmitter is through composer., (*4)

Just create a composer.json file for your project:, (*5)

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

And run these two commands to install it:, (*6)

$ 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:, (*7)

<?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., (*8)

The Versions

18/04 2015

dev-master

9999999-dev

EventEmitter is a very simple event dispatching library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

event-dispatcher event-emitter