Skip to content

PSR-14 event dispatcher

Notifications You must be signed in to change notification settings

Tolkam-PHP-Components/psr14-dispatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tolkam/psr14-dispatcher

PSR-14 event dispatcher.

Documentation

The code is rather self-explanatory and API is intended to be as simple as possible. Please, read the sources/Docblock if you have any questions. See Usage for quick start.

Usage

use Tolkam\PSR14\EventDispatcher;
use Tolkam\PSR14\Provider\CallableListenerProvider;

$event = new stdClass;
$event->value = 'value';

$listenerProvider = new CallableListenerProvider;

$listenerProvider->addListener(stdClass::class, function (object $event) {
    echo 'Event value: ' . $event->value . PHP_EOL;
});

$eventDispatcher = new EventDispatcher([
    $listenerProvider,
]);

$event = $eventDispatcher->dispatch($event);

License

Proprietary / Unlicensed 🤷

About

PSR-14 event dispatcher

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages