The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Versions:

Getting Started

Events

Listeners

Generator

Named Events

The emitter accepts strings as events, which will be converted to a Event instance.

<?php
use League\Event\Event;

$emitter->addListener('string.event.name', function (Event $event) {
    echo $event->getName(); // echo's "string.event.name"
});

$emitter->emit('string.event.name');
// OR even better:
$emitter->emit(Event::named('string.event.name'));