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 array $customCreators

The registered custom driver creators.

from  Manager
protected array $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

Closure|null
bindCallbackToSelf(Closure $callback)

Bind the provided callback to the class instance.

__construct(Container $container)

Create a new manager instance.

from  Manager
string
getDefaultDriver()

Get the default channel driver name.

mixed
driver(UnitEnum|string|null $driver = null)

Get a driver instance.

from  Manager
mixed
createDriver(string $driver)

Create a new driver instance.

mixed
callCustomCreator(string $driver)

Call a custom driver creator.

from  Manager
extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

from  Manager
array
getDrivers()

Get all of the created "drivers".

from  Manager
getContainer()

Get the container instance used by the manager.

from  Manager
setContainer(Container $container)

Set the container instance used by the manager.

from  Manager
forgetDrivers()

Forget all of the resolved driver instances.

from  Manager
mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

string|null
resolveConnectionFromQueueRoute(object $queueable)

Resolve the default connection name for a given queueable instance.

string|null
resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

queueRoutes()

Get the queue routes manager instance.

void
send(mixed $notifiables, mixed $notification)

Send the given notification to the given notifiable entities.

void
sendNow(mixed $notifiables, mixed $notification, array|null $channels = null)

Send the given notification immediately.

mixed
channel(UnitEnum|string|null $name = null)

Get a channel instance.

createDatabaseDriver()

Create an instance of the database driver.

createBroadcastDriver()

Create an instance of the broadcast driver.

createMailDriver()

Create an instance of the mail driver.

createSlackDriver()

Create an instance of the slack driver.

string
deliversVia()

Get the default channel driver name.

void
deliverVia(string $channel)

Set the default channel driver name.

locale(string $locale)

Set the locale of notifications.

string|null
getLocale()

Get the locale of notifications.

static void
flushState()

Flush all static state.

Details

protected Closure|null bindCallbackToSelf(Closure $callback)

Bind the provided callback to the class instance.

Parameters

Closure $callback

Return Value

Closure|null

Exceptions

ReflectionException

in Manager at line 37
__construct(Container $container)

Create a new manager instance.

Parameters

Container $container

at line 134
string getDefaultDriver()

Get the default channel driver name.

Return Value

string

in Manager at line 53
mixed driver(UnitEnum|string|null $driver = null)

Get a driver instance.

Parameters

UnitEnum|string|null $driver

Return Value

mixed

Exceptions

InvalidArgumentException

at line 118
protected mixed createDriver(string $driver)

Create a new driver instance.

Parameters

string $driver

Return Value

mixed

Exceptions

InvalidArgumentException

in Manager at line 99
protected mixed callCustomCreator(string $driver)

Call a custom driver creator.

Parameters

string $driver

Return Value

mixed

in Manager at line 112
Manager extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.

Parameters

string $driver
Closure $callback

Return Value

Manager

in Manager at line 129
array getDrivers()

Get all of the created "drivers".

Return Value

array

in Manager at line 137
Container getContainer()

Get the container instance used by the manager.

Return Value

Container

in Manager at line 151
Manager setContainer(Container $container)

Set the container instance used by the manager.

Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent driver resolution through this manager.

Parameters

Container $container

Return Value

Manager

in Manager at line 167
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.

Return Value

Manager

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

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.

Parameters

string $name
callable|object $macro

Return Value

void

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.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

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.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

string|null resolveConnectionFromQueueRoute(object $queueable)

Resolve the default connection name for a given queueable instance.

Parameters

object $queueable

Return Value

string|null

string|null resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

Parameters

object $queueable

Return Value

string|null

protected QueueRoutes queueRoutes()

Get the queue routes manager instance.

Return Value

QueueRoutes

at line 50
void send(mixed $notifiables, mixed $notification)

Send the given notification to the given notifiable entities.

Parameters

mixed $notifiables
mixed $notification

Return Value

void

at line 63
void sendNow(mixed $notifiables, mixed $notification, array|null $channels = null)

Send the given notification immediately.

Parameters

mixed $notifiables
mixed $notification
array|null $channels

Return Value

void

at line 76
mixed channel(UnitEnum|string|null $name = null)

Get a channel instance.

Parameters

UnitEnum|string|null $name

Return Value

mixed

at line 84
protected DatabaseChannel createDatabaseDriver()

Create an instance of the database driver.

Return Value

DatabaseChannel

at line 92
protected BroadcastChannel createBroadcastDriver()

Create an instance of the broadcast driver.

Return Value

BroadcastChannel

at line 100
protected MailChannel createMailDriver()

Create an instance of the mail driver.

Return Value

MailChannel

at line 108
protected SlackNotificationRouterChannel createSlackDriver()

Create an instance of the slack driver.

at line 142
string deliversVia()

Get the default channel driver name.

Return Value

string

at line 150
void deliverVia(string $channel)

Set the default channel driver name.

Parameters

string $channel

Return Value

void

at line 158
ChannelManager locale(string $locale)

Set the locale of notifications.

Parameters

string $locale

Return Value

ChannelManager

at line 168
string|null getLocale()

Get the locale of notifications.

Return Value

string|null

at line 176
static void flushState()

Flush all static state.

Return Value

void