The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Versions:

Getting Started

Usage

Extra Utilities

Event Dispatcher Aware

To reduce boilerplate code, an interface and trait are shipped to quickly allow code that depends on an event dispatcher to use it.

class DependantOnEventDispatcher implements League\Event\EventDispatcherAware{
    use League\Event\EventDispatcherAwareBehavior;
}

$instance = new DependantOnEventDispatcher();

// retrieve an event dispatcher
$eventDispatcher = $instance->eventDispatcher();

// you can also instruct which instance of an event dispatcher to use
$instance->useEventDispatcher($eventDispatcher);