PHP MIT

evenement

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

I

igorw

Dernière activité 26 déc. 2025
igorw/evenement

1,4 k

étoiles

73

forks

3

issues ouvertes

Ce README est souvent en anglais.

É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.

Projets similaires

The Doctrine Event Manager is a library that provides a simple event system.

PHPeventeventmanager
Ddoctrine
6 k étoiles22

The sabre/event library provides utilities for lightweight event-based programming

PHP
Ssabre-io
352 étoiles27

Provides tools that allow your application components to communicate with each other by dispatching events and listening to them

PHPcomponentphpsymfony
Ssymfony
8,5 k étoiles66