laravel-notify-templates maintained by fomvasss
Description
Notification templates management for Laravel: DB-based templates, role/user subscriptions, channel resolution.
Author
Last update
2026/10/10 10:52
(dev-master)
License
Downloads
66
Tags
Laravel Notify Templates
Database-driven notification templates for Laravel. Admins edit the subject and body of every notification per channel, role and tenant; the package picks the right template, resolves the delivery channels from role subscriptions and user preferences, and logs what was delivered — without tying you to a role package.
- Templates in the database — per notify type × channel slot × role × tenant, with an 8-level fallback down to defaults in code
- Type registry — notify types auto-discovered from
app/Notifications, with metadata for an admin UI - Role subscriptions — which roles get which type, through which channels, with what delay
- User preferences — turn a type off or narrow its channels per user; non-optional types for OTP codes
- One
via()chain for built-in and custom channels (Telegram, SMS, …) through amapChannel()hook - Messenger buttons — link buttons under Telegram messages, multilingual
- Delivery log —
notify_logswith provider statusessent→delivered→read
Requirements
- PHP ^8.2
- Laravel 10 – 13
- PostgreSQL, MySQL 8.0.13+ or SQLite (not MariaDB)
Installation
composer require fomvasss/laravel-notify-templates
php artisan vendor:publish --tag=notify-templates-migrations
php artisan migrate
Quick start
php artisan notify:make OrderOrdered
use Fomvasss\NotifyTemplates\Notifications\BaseNotify;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
final class OrderOrderedNotify extends BaseNotify implements ShouldQueue
{
use Queueable;
public function __construct(protected Order $order, protected string $roleKey) {}
public static function typeDefinition(): array
{
return [
'key' => 'OrderOrdered',
'name' => 'Order placed',
'group' => 'order',
'defaults' => [
'mail' => ['subject' => 'Order placed', 'body' => 'Your order [order:number] has been received.'],
],
];
}
protected function prepareText(string $text, mixed $notifiable): string
{
return str_replace('[order:number]', $this->order->number, $text);
}
}
use Fomvasss\NotifyTemplates\Models\NotifyRoleSubscription;
NotifyRoleSubscription::create(['role_key' => 'client', 'notify_key' => 'OrderOrdered', 'channels' => ['mail']]);
$user->notify(new OrderOrderedNotify($order, 'client'));
Documentation
Online: https://fomvasss.github.io/laravel-notify-templates/ — the same pages as in docs/.
- Installation · Configuration
- Notify types · Sending · Recipients & role subscriptions · Templates
- Channel resolution · User preferences · Custom channels · Messenger buttons
- Delivery log · Multi-tenancy · Multilingual templates · Queues & Octane
- Reference: Facade · BaseNotify · typeDefinition() · Tables & models · Contracts · Artisan & publishing
- Upgrading · Changelog
License
MIT — see LICENSE.