Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 661 Bytes

File metadata and controls

28 lines (21 loc) · 661 Bytes

Template Notifications

Template notifications carry a template name and data. Rendering can happen before delivery in application code or inside a provider driver.

<?php

use CommonPHP\Notifications\Notifier;

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

$result = $notifier->sendTemplate(
    template: 'auth.password-reset',
    data: ['url' => $resetUrl, 'expires_minutes' => 30],
    channel: 'email',
    recipients: ['ada@example.com'],
    subject: 'Reset your password',
    metadata: ['flow' => 'password-reset'],
    tags: ['auth', 'security'],
);

Drivers can inspect:

$notification->templateName();
$notification->dataItems();