Dispatcher

interface Dispatcher (View source)

Methods

void listen(string|array $events, Closure|string $listener)

Register an event listener with the dispatcher.

bool hasListeners(string $eventName)

Determine if a given event has listeners.

void subscribe(object|string $subscriber)

Register an event subscriber with the dispatcher.

array|null until(string|object $event, mixed $payload = [])

Dispatch an event until the first non-null response is returned.

array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false)

Dispatch an event and call the listeners.

void push(string $event, array $payload = [])

Register an event and payload to be fired later.

void flush(string $event)

Flush a set of pushed events.

void forget(string $event)

Remove a set of listeners from the dispatcher.

void forgetPushed()

Forget all of the queued listeners.

Details

void listen(string|array $events, Closure|string $listener)

Register an event listener with the dispatcher.

Parameters

string|array $events
Closure|string $listener

Return Value

void

bool hasListeners(string $eventName)

Determine if a given event has listeners.

Parameters

string $eventName

Return Value

bool

void subscribe(object|string $subscriber)

Register an event subscriber with the dispatcher.

Parameters

object|string $subscriber

Return Value

void

array|null until(string|object $event, mixed $payload = [])

Dispatch an event until the first non-null response is returned.

Parameters

string|object $event
mixed $payload

Return Value

array|null

array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false)

Dispatch an event and call the listeners.

Parameters

string|object $event
mixed $payload
bool $halt

Return Value

array|null

void push(string $event, array $payload = [])

Register an event and payload to be fired later.

Parameters

string $event
array $payload

Return Value

void

void flush(string $event)

Flush a set of pushed events.

Parameters

string $event

Return Value

void

void forget(string $event)

Remove a set of listeners from the dispatcher.

Parameters

string $event

Return Value

void

void forgetPushed()

Forget all of the queued listeners.

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/6.x/Illuminate/Contracts/Events/Dispatcher.html