An open API service indexing awesome lists of open source software.

https://github.com/the-control-group/php-event-emitter

A simple class for emitting, fetching and consuming event messages.
https://github.com/the-control-group/php-event-emitter

code composer tcg-pubrec-services

Last synced: about 1 month ago
JSON representation

A simple class for emitting, fetching and consuming event messages.

Awesome Lists containing this project

README

          

PHP Event Emitter
=================
[![wercker status](https://app.wercker.com/status/bf7682ab160fc8e4a2acdb4b2721f582/s "wercker status")](https://app.wercker.com/project/bykey/bf7682ab160fc8e4a2acdb4b2721f582)

A simple event emiter class with glob pattern matching.

Usage
-----

Using the base Emitter class:

```php
on('order:*', $callable);

// remove a listener
$emitter->off('order:*', $callable);

// remove all listeners for a given pattern
$emitter->off('order:*');

// emit an event
$emitter->emit('order:success', 123456, 22.86);

```

Using the provided [slim](http://www.slimframework.com) middleware:

```php
add(new \TCG\Event\Middleware());

```