ChannelManager
class ChannelManager extends Manager implements Dispatcher, Factory
Traits
Constants
| protected DEFAULT_CHANNEL_CONTEXT_KEY |
Context key for the per-request default channel override. |
| protected DEFAULT_LOCALE_CONTEXT_KEY |
Context key for the per-request default locale override. |
Properties
| protected Repository | $config | The configuration repository instance. |
from Manager |
| protected Closure> | $customCreators | The registered custom driver creators. |
from Manager |
| protected array<array-key, mixed> | $drivers | The array of created "drivers". |
from Manager |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected string | $defaultChannel | The default channel used to deliver messages. |
|
| protected string|null | $locale | The locale used when sending notifications. |
Methods
Get the default channel driver name.
Create a new driver instance.
Dynamically handle calls to the class.
Mix another object into the class.
Dynamically handle calls to the class.
Resolve the default connection name for a given queueable instance.
Resolve the default queue name for a given queueable instance.
Get the container that owns the queue routes.
Send the given notification to the given notifiable entities.
Send the given notification immediately.
Get a channel instance.
Create an instance of the database driver.
Create an instance of the broadcast driver.
Create an instance of the mail driver.
Create an instance of the slack driver.
Get the default channel driver name.
Set the default channel driver name.
Set the locale of notifications.
Get the locale of notifications.
Flush all static state.
Details
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
at line 144
string|null
getDefaultDriver()
Get the default channel driver name.
in
Manager at line 57
mixed
driver(UnitEnum|string|null $driver = null)
Get a driver instance.
at line 128
protected mixed
createDriver(string $driver)
Create a new driver instance.
in
Manager at line 110
protected mixed
callCustomCreator(string $driver)
Call a custom driver creator.
in
Manager at line 126
Manager
extend(string $driver, Closure $callback)
Register a custom driver creator Closure.
Anonymous closures run in this manager's class scope; non-static closures also receive the manager as $this.
Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.
in
Manager at line 145
array
getDrivers()
Get all of the created "drivers".
in
Manager at line 167
Manager
setContainer(Container $container)
Set the container instance used by the manager.
Tests only. Swaps the singleton's container and configuration references; per-request use races across coroutines and breaks every concurrent driver resolution through this manager.
in
Manager at line 184
Manager
forgetDrivers()
Forget all of the resolved driver instances.
Boot or tests only. Clears the singleton's driver cache; concurrent coroutines may already hold references that next resolution will not share.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
ResolvesQueueRoutes at line 19
string|null
resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)
Resolve the default connection name for a given queueable instance.
in
ResolvesQueueRoutes at line 27
string|null
resolveQueueFromQueueRoute(object $queueable)
Resolve the default queue name for a given queueable instance.
in
ResolvesQueueRoutes at line 35
protected QueueRoutes
queueRoutes()
Get the queue routes manager instance.
at line 78
protected Container
queueRoutesContainer()
Get the container that owns the queue routes.
at line 52
void
send(mixed $notifiables, mixed $notification)
Send the given notification to the given notifiable entities.
at line 65
void
sendNow(mixed $notifiables, mixed $notification, array|null $channels = null)
Send the given notification immediately.
at line 86
mixed
channel(UnitEnum|string|null $name = null)
Get a channel instance.
at line 94
protected DatabaseChannel
createDatabaseDriver()
Create an instance of the database driver.
at line 102
protected BroadcastChannel
createBroadcastDriver()
Create an instance of the broadcast driver.
at line 110
protected MailChannel
createMailDriver()
Create an instance of the mail driver.
at line 118
protected SlackNotificationRouterChannel
createSlackDriver()
Create an instance of the slack driver.
at line 152
string
deliversVia()
Get the default channel driver name.
at line 160
void
deliverVia(string $channel)
Set the default channel driver name.
at line 174
ChannelManager
locale(string $locale)
Set the locale of notifications.
at line 188
string|null
getLocale()
Get the locale of notifications.
at line 204
static void
flushState()
Flush all static state.