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 next send's 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 default notification locale configured during boot. |
Methods
Get the default channel driver name.
Create a new driver instance.
Get the name of the manager's creator method for the given driver.
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.
Resolve the notification sender instance.
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 145
string|null
getDefaultDriver()
Get the default channel driver name.
in
Manager at line 60
mixed
driver(UnitEnum|string|null $driver = null)
Get a driver instance.
at line 112
protected mixed
createDriver(string $driver)
Create a new driver instance.
in
Manager at line 113
protected string|null
getCreatorMethod(string $driver)
Get the name of the manager's creator method for the given driver.
in
Manager at line 124
protected mixed
callCustomCreator(string $driver)
Call a custom driver creator.
in
Manager at line 140
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.
The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.
in
Manager at line 160
array
getDrivers()
Get all of the created "drivers".
in
Manager at line 182
Manager
setContainer(Container $container)
Set the container instance used by the manager.
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 199
Manager
forgetDrivers()
Forget all of the resolved driver instances.
Clears the singleton's driver cache; concurrent coroutines may already hold references that next resolution will not share.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
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 70
protected Container
queueRoutesContainer()
Get the container that owns the queue routes.
at line 54
void
send(mixed $notifiables, mixed $notification)
Send the given notification to the given notifiable entities.
at line 62
void
sendNow(mixed $notifiables, mixed $notification, array|null $channels = null)
Send the given notification immediately.
at line 78
mixed
channel(UnitEnum|string|null $name = null)
Get a channel instance.
at line 86
protected DatabaseChannel
createDatabaseDriver()
Create an instance of the database driver.
at line 94
protected BroadcastChannel
createBroadcastDriver()
Create an instance of the broadcast driver.
at line 102
protected MailChannel
createMailDriver()
Create an instance of the mail driver.
at line 128
protected NotificationSender
resolveNotificationSender()
Resolve the notification sender instance.
at line 153
string
deliversVia()
Get the default channel driver name.
at line 161
void
deliverVia(string $channel)
Set the default channel driver name.
at line 177
ChannelManager
locale(string $locale)
Set the locale of notifications.
at line 191
string|null
getLocale()
Get the locale of notifications.
at line 207
static void
flushState()
Flush all static state.