ChannelRegistry
final class ChannelRegistry
Registry for notification channel drivers.
This static registry maps short channel names (e.g., "database", "mail") to their concrete {\Core\Lib\Notifications\Contracts\Channel} implementation classes. Providers register channels during application boot, and the notifier resolves them at runtime before delivery.
Notes:
- Registering the same name more than once will overwrite the previous mapping.
- {\Core\Lib\Notifications\resolve()} instantiates the channel using a no-argument constructor. If your channel requires dependencies, adapt this class to use your container.
Typical flow: 1) A service/provider calls {\Core\Lib\Notifications\ChannelRegistry::register()} during boot. 2) When sending, {\Core\Lib\Notifications\ChannelRegistry::resolve()} returns a Channel instance.
Properties
| static private Channel>> | $map | Map of channel name => channel class. |
Methods
Return array of channel classes.
Checks if channel name exists.
Register (or override) a channel implementation under a short name.
Details
at line 44
static array
all()
Return array of channel classes.
at line 54
static bool
has(string $name)
Checks if channel name exists.
at line 68
static void
register(string $name, string $channelClass)
Register (or override) a channel implementation under a short name.
Call this during application boot (e.g., in a service provider).
at line 84
static Channel
resolve(string $name)
Resolve a channel by name into a concrete {Channel} instance.
The channel class is instantiated with a zero-argument constructor. If the channel is not registered, a {\RuntimeException} is thrown.