Yannick Warnier 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
..
doc 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
src 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
tests 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
.gitignore 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
.travis.yml 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
LICENSE 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
README.md 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
composer.json 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години
phpunit.xml.dist 76a0eae5ea Add static resources and remove tests dir for beta release преди 5 години

README.md

Événement

Événement is a very simple event dispatching library for PHP 5.3.

It has the same design goals as Silex and Pimple, to empower the user while staying concise and simple.

It is very strongly inspired by the EventEmitter API found in node.js. It includes an implementation of EventEmitter2, that extends the original EventEmitter.

Build Status

Fetch

The recommended way to install Événement is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "evenement/evenement": "1.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 Evenement\EventEmitter();

Adding Listeners

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

Emitting Events

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

Tests

$ phpunit

License

MIT, see LICENSE.