Skip to content

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

License

Notifications You must be signed in to change notification settings

igorw/evenement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6cdcb88 · Dec 28, 2024
May 20, 2024
Apr 17, 2024
Apr 17, 2024
May 20, 2024
May 20, 2024
Apr 17, 2024
May 20, 2024
Apr 17, 2024
Aug 16, 2011
Dec 22, 2024
Apr 17, 2024
Apr 17, 2024

Repository files navigation

É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', static function (User $user) use ($logger): void {
    $logger->log(sprintf("User '%s' was created.", $user->getLogin()));
});

Removing Listeners

<?php
$emitter->removeListener('user.created', static function (User $user) use ($logger): void {
    $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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages