edps / edps
PHP 5.2 port of Événement
Installs: 3 314
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 74
pkg:composer/edps/edps
Requires
- php: >=5.2.0
This package is auto-updated.
Last update: 2025-12-26 00:33:55 UTC
README
EDPS is a PHP 5.2 port of igorw's Événement.
Fetch
The recommended way to install EDPS is through composer.
Just create a composer.json file for your project:
{
"require": {
"edps/edps": "dev-master"
}
}
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 Edps_EventEmitter();
Adding Listeners (>= PHP 5.3)
<?php $emitter->on('user.create', function (User $user) use ($logger) { $logger->log(sprintf("User '%s' was created.", $user->getLogin())); });
Adding Listeners (< PHP 5.3)
<?php $emitter->on('user.create', 'onUserCreate'); function onUserCreate(User $user) { global $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.