A channel is a normalized name mapped to a NotificationDriverInterface implementation.
use CommonPHP\Notifications\ChannelRegistry;
$channels = ChannelRegistry::single('email', $emailDriver)
->register('sms', $smsDriver)
->register('webhook', $webhookDriver);The first registered channel becomes the default unless another channel is registered or set as default.
$channels->setDefault('sms');
$driver = $channels->get();$notifier
->registerChannel('email', $emailDriver)
->useChannel('sms', $smsDriver, default: true)
->useDefaultChannel('email');registerChannel() rejects duplicate channel names. useChannel() replaces or creates a channel.
Drivers implement:
use CommonPHP\Notifications\Contracts\NotificationDriverInterface;
interface NotificationDriverInterface
{
public function getName(): string;
public function supports(Notification $notification, string $channel): bool;
public function send(Notification $notification, string $channel): DeliveryResult;
}Use AbstractNotificationDriver when implementing a custom driver. It provides a default getName(), a default permissive supports(), recipient filtering, and helper methods for sent, queued, skipped, and failed results.
ArrayNotificationDriver records successful deliveries in memory. It is useful for tests and local development.
NullNotificationDriver returns a skipped delivery result and does not store anything. It is useful when notifications are intentionally disabled.