openclerk/events

There is no license information available for the latest version (0.2.0) of this package.

Simple PHP events

0.2.0 2015-04-01 04:19 UTC

This package is auto-updated.

Last update: 2024-11-14 09:22:55 UTC


README

A library for registering event handlers and triggering events, live on CryptFolio.

Installing

Include openclerk/events as a requirement in your project composer.json, and run composer update to install it into your project:

{
  "require": {
    "openclerk/events": "dev-master"
  }
}

Using

Add a handler for an event type:

Events::on('my_event', function($data) {
  echo "one = " . $data['one'];
});

Trigger an event with custom event data:

Events::trigger('my_event', array('one' => 'two'));

Unbind handlers as necessary:

$handle = Events::on('my_event', array($object, 'callback'));
// ...
Events::unbind($handle);