Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 610 Bytes

File metadata and controls

32 lines (23 loc) · 610 Bytes

Basic Delivery

Use Notifier::memory() for local development or tests.

<?php

declare(strict_types=1);

use CommonPHP\Notifications\Notification;
use CommonPHP\Notifications\Notifier;

$notifier = Notifier::memory('email');

$result = $notifier->send(
    new Notification(
        subject: 'Welcome',
        body: 'Thanks for creating an account.',
        recipients: ['ada@example.com'],
        tags: ['welcome'],
    ),
    'email',
);

echo $result->status()->value;

For real delivery, register a provider driver:

$notifier->useChannel('email', $smtpDriver, default: true);