elephox/events

Elephox events library.

v0.7.0 2022-09-09 21:40 UTC

README

This module is used by Elephox to provide an event bus with broadcasters and listeners.

Example

<?php

use Elephox\Events\EventBus;

$bus = new EventBus();
$subscription = $bus->subscribe('test', function ($data) {
    echo 'test event: ' . $data;
});

$bus->publish('test', 'test data'); // "test event: test data"

$bus->unsubscribe($subscription);

$bus->publish('test', 'test data'); // no output