Dispatcher
class Dispatcher (View source)
Properties
protected Container | $container | The IoC container instance. | |
protected array | $listeners | The registered event listeners. | |
protected array | $wildcards | The wildcard listeners. | |
protected array | $sorted | The sorted event listeners. | |
protected array | $firing | The event firing stack. |
Methods
void | __construct(Container $container = null) Create a new event dispatcher instance. | |
void | listen(string|array $events, mixed $listener, int $priority) Register an event listener with the dispatcher. | |
void | setupWildcardListen(string $event, mixed $listener) Setup a wildcard listener callback. | |
bool | hasListeners(string $eventName) Determine if a given event has listeners. | |
void | queue(string $event, array $payload = array()) Register a queued event and payload. | |
void | subscribe(string $subscriber) Register an event subscriber with the dispatcher. | |
mixed | resolveSubscriber(mixed $subscriber) Resolve the subscriber instance. | |
mixed | until(string $event, array $payload = array()) Fire an event until the first non-null response is returned. | |
void | flush(string $event) Flush a set of queued events. | |
string | firing() Get the event that is currently firing. | |
array|null | fire(string $event, mixed $payload = array(), bool $halt = false) Fire an event and call the listeners. | |
array | getListeners(string $eventName) Get all of the listeners for a given event name. | |
array | getWildcardListeners(string $eventName) Get the wildcard listeners for the event. | |
array | sortListeners(string $eventName) Sort the listeners for a given event by priority. | |
mixed | makeListener(mixed $listener) Register an event listener with the dispatcher. | |
Closure | createClassListener(mixed $listener) Create a class based listener using the IoC container. | |
void | forget(string $event) Remove a set of listeners from the dispatcher. | |
void | forgetQueued() Forget all of the queued listeners. |
Details
void __construct(Container $container = null)
Create a new event dispatcher instance.
void listen(string|array $events, mixed $listener, int $priority)
Register an event listener with the dispatcher.
protected void setupWildcardListen(string $event, mixed $listener)
Setup a wildcard listener callback.
bool hasListeners(string $eventName)
Determine if a given event has listeners.
void queue(string $event, array $payload = array())
Register a queued event and payload.
void subscribe(string $subscriber)
Register an event subscriber with the dispatcher.
protected mixed resolveSubscriber(mixed $subscriber)
Resolve the subscriber instance.
mixed until(string $event, array $payload = array())
Fire an event until the first non-null response is returned.
void flush(string $event)
Flush a set of queued events.
string firing()
Get the event that is currently firing.
array|null fire(string $event, mixed $payload = array(), bool $halt = false)
Fire an event and call the listeners.
array getListeners(string $eventName)
Get all of the listeners for a given event name.
protected array getWildcardListeners(string $eventName)
Get the wildcard listeners for the event.
protected array sortListeners(string $eventName)
Sort the listeners for a given event by priority.
mixed makeListener(mixed $listener)
Register an event listener with the dispatcher.
Closure createClassListener(mixed $listener)
Create a class based listener using the IoC container.
void forget(string $event)
Remove a set of listeners from the dispatcher.
void forgetQueued()
Forget all of the queued listeners.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Events/Dispatcher.html