rector/vendor/evenement/evenement
Tomas Votruba 695c190be3 Updated Rector to commit 94b5561ca87ee6825a098c7c506b774582bf3354
94b5561ca8 chore: bump min version of github actions (fix deprecations) (#5675)
2024-03-01 20:02:28 +00:00
..
src Updated Rector to commit 94b5561ca87ee6825a098c7c506b774582bf3354 2024-03-01 20:02:28 +00:00
composer.json Updated Rector to commit 94b5561ca87ee6825a098c7c506b774582bf3354 2024-03-01 20:02:28 +00:00
LICENSE Updated Rector to commit 21c9c1c16d 2021-11-23 13:20:36 +00:00
README.md Updated Rector to commit eed1dca02b44f63a00f232631763eddce1545094 2023-08-08 08:50:04 +00:00

Événement

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

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.

Continuous Integration Latest Stable Version Total Downloads License

Fetch

The recommended way to install Événement is through composer. By running the following command:

$ composer require evenement/evenement

Usage

Creating an Emitter

<?php
$emitter = new Evenement\EventEmitter();

Adding Listeners

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

Removing Listeners

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

Emitting Events

<?php
$emitter->emit('user.created', [$user]);

Tests

$ ./vendor/bin/phpunit

License

MIT, see LICENSE.