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.
- Host: GitHub
- URL: https://github.com/the-control-group/php-event-emitter
- Owner: the-control-group
- License: mit
- Created: 2015-02-12T23:22:30.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T22:35:25.000Z (over 1 year ago)
- Last Synced: 2025-09-22T05:39:25.288Z (about 2 months ago)
- Topics: code, composer, tcg-pubrec-services
- Language: PHP
- Homepage:
- Size: 116 KB
- Stars: 5
- Watchers: 54
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
PHP Event Emitter
=================
[](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());
```