class Dispatcher implements Dispatcher (View source)
| Macroable | |
| ReflectsClosures |
| static protected array | $macros | The registered string macros. | from Macroable |
| protected Container | $container | The IoC container instance. | |
| protected array | $listeners | The registered event listeners. | |
| protected array | $wildcards | The wildcard listeners. | |
| protected array | $wildcardsCache | The cached wildcard listeners. | |
| protected callable | $queueResolver | The queue resolver instance. | |
| protected callable | $transactionManagerResolver | The database transaction manager resolver instance. |
| static void | macro(string $name, object|callable $macro)
Register a custom macro. | from Macroable |
| static void | mixin(object $mixin, bool $replace = true)
Mix another object into the class. | from Macroable |
| static bool | hasMacro(string $name)
Checks if macro is registered. | from Macroable |
| static void | flushMacros()
Flush the existing macros. | from Macroable |
| static mixed | __callStatic(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| mixed | __call(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| string | firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure. | from ReflectsClosures |
| array | firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types. | from ReflectsClosures |
| array | closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure. | from ReflectsClosures |
| void | __construct(Container|null $container = null)
Create a new event dispatcher instance. | |
| void | listen(Closure|string|array $events, Closure|string|array|null $listener = null)
Register an event listener with the dispatcher. | |
| void | setupWildcardListen(string $event, Closure|string $listener)
Setup a wildcard listener callback. | |
| bool | hasListeners(string $eventName)
Determine if a given event has listeners. | |
| bool | hasWildcardListeners(string $eventName)
Determine if the given event has any wildcard 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 | subscribe(object|string $subscriber)
Register an event subscriber with the dispatcher. | |
| mixed | resolveSubscriber(object|string $subscriber)
Resolve the subscriber instance. | |
| mixed | until(string|object $event, mixed $payload = [])
Fire an event until the first non-null response is returned. | |
| array|null | dispatch(string|object $event, mixed $payload = [], bool $halt = false)
Fire an event and call the listeners. | |
| array|null | invokeListeners(string|object $event, mixed $payload, bool $halt = false)
Broadcast an event and call its listeners. | |
| array | parseEventAndPayload(mixed $event, mixed $payload)
Parse the given event and payload and prepare them for dispatching. | |
| bool | shouldBroadcast(array $payload)
Determine if the payload has a broadcastable event. | |
| bool | broadcastWhen(mixed $event)
Check if the event should be broadcasted by the condition. | |
| void | broadcastEvent(ShouldBroadcast $event)
Broadcast the given event class. | |
| 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 | addInterfaceListeners(string $eventName, array $listeners = [])
Add the listeners for the event's interfaces to the given array. | |
| Closure[] | prepareListeners(string $eventName)
Prepare the listeners for a given event. | |
| Closure | makeListener(Closure|string|array $listener, bool $wildcard = false)
Register an event listener with the dispatcher. | |
| Closure | createClassListener(string $listener, bool $wildcard = false)
Create a class based listener using the IoC container. | |
| callable | createClassCallable(array|string $listener)
Create the class based event callable. | |
| array | parseClassCallable(string $listener)
Parse the class listener into class and method. | |
| bool | handlerShouldBeQueued(string $class)
Determine if the event handler class should be queued. | |
| Closure | createQueuedHandlerCallable(string $class, string $method)
Create a callable for putting an event handler on the queue. | |
| bool | handlerShouldBeDispatchedAfterDatabaseTransactions(object|mixed $listener)
Determine if the given event handler should be dispatched after all database transactions have committed. | |
| Closure | createCallbackForListenerRunningAfterCommits(mixed $listener, string $method)
Create a callable for dispatching a listener after database transactions. | |
| bool | handlerWantsToBeQueued(string $class, array $arguments)
Determine if the event handler wants to be queued. | |
| void | queueHandler(string $class, string $method, array $arguments)
Queue the handler class. | |
| array | createListenerAndJob(string $class, string $method, array $arguments)
Create the listener and job for a queued listener. | |
| mixed | propagateListenerOptions(mixed $listener, CallQueuedListener $job)
Propagate listener options to the job. | |
| void | forget(string $event)
Remove a set of listeners from the dispatcher. | |
| void | forgetPushed()
Forget all of the pushed listeners. | |
| Queue | resolveQueue()
Get the queue implementation from the resolver. | |
| $this | setQueueResolver(callable $resolver)
Set the queue resolver implementation. | |
| DatabaseTransactionsManager|null | resolveTransactionManager()
Get the database transaction manager implementation from the resolver. | |
| $this | setTransactionManagerResolver(callable $resolver)
Set the database transaction manager resolver implementation. | |
| array | getRawListeners()
Gets the raw, unprepared listeners. |
Register a custom macro.
Mix another object into the class.
Checks if macro is registered.
Flush the existing macros.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Get the class name of the first parameter of the given Closure.
Get the class names of the first parameter of the given Closure, including union types.
Get the class names / types of the parameters of the given Closure.
Create a new event dispatcher instance.
Register an event listener with the dispatcher.
Setup a wildcard listener callback.
Determine if a given event has listeners.
Determine if the given event has any wildcard listeners.
Register an event and payload to be fired later.
Flush a set of pushed events.
Register an event subscriber with the dispatcher.
Resolve the subscriber instance.
Fire an event until the first non-null response is returned.
Fire an event and call the listeners.
Broadcast an event and call its listeners.
Parse the given event and payload and prepare them for dispatching.
Determine if the payload has a broadcastable event.
Check if the event should be broadcasted by the condition.
Broadcast the given event class.
Get all of the listeners for a given event name.
Get the wildcard listeners for the event.
Add the listeners for the event's interfaces to the given array.
Prepare the listeners for a given event.
Register an event listener with the dispatcher.
Create a class based listener using the IoC container.
Create the class based event callable.
Parse the class listener into class and method.
Determine if the event handler class should be queued.
Create a callable for putting an event handler on the queue.
Determine if the given event handler should be dispatched after all database transactions have committed.
Create a callable for dispatching a listener after database transactions.
Determine if the event handler wants to be queued.
Queue the handler class.
Create the listener and job for a queued listener.
Propagate listener options to the job.
Remove a set of listeners from the dispatcher.
Forget all of the pushed listeners.
Get the queue implementation from the resolver.
Set the queue resolver implementation.
Get the database transaction manager implementation from the resolver.
Set the database transaction manager resolver implementation.
Gets the raw, unprepared listeners.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Events/Dispatcher.html