NotificationsServiceProvider integrates the package with CommonPHP Runtime and PHP-DI.
The provider registers:
ArrayNotificationDriverNotificationDriverInterfaceChannelRegistryNotifierNotifierInterface
The default binding uses ArrayNotificationDriver on the default channel. Applications should override these definitions or replace channels when wiring real provider drivers.
use CommonPHP\Notifications\NotificationsServiceProvider;
use CommonPHP\Runtime\Kernel;
$kernel = new Kernel();
$kernel->useServiceProvider(new NotificationsServiceProvider());Once configured, application services can depend on NotifierInterface.
use CommonPHP\Notifications\Contracts\NotifierInterface;
final readonly class WelcomeUser
{
public function __construct(private NotifierInterface $notifications)
{
}
}Provider packages can expose their own service provider and bind NotificationDriverInterface, or application setup can fetch Notifier and register named channels explicitly.