notebrainslab/filament-email-templates
A sleek, powerful, and professional visual email designer for Filament v4 and v5. Build beautiful, pixel-perfect responsive email layouts using an integrated Unlayer drag-and-drop editor and integrate them into your own Laravel Mailables with ease.
{{user_name}}) with robust injection logic for both the subject and body.HasEmailTemplate trait to power any standard Laravel Mailable from your visual templates.auth.welcome, order.failed).Install the package via Composer:
composer require notebrainslab/filament-email-templates
Run the install command to publish migrations and config:
php artisan filament-email-templates:install
Run the migrations if you didnβt execute them during installation:
php artisan migrate
Update the package version: Run the following command in your Laravel application:
composer require notebrainslab/filament-email-templates:^2.0
Clear view and application cache:
php artisan view:clear
php artisan cache:clear
Add the plugin to your Filament Panel Provider (e.g. app/Providers/Filament/AdminPanelProvider.php):
use NoteBrainsLab\FilamentEmailTemplates\FilamentEmailTemplatesPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentEmailTemplatesPlugin::make(),
]);
}
All options are optional β the plugin works out of the box with sensible defaults.
FilamentEmailTemplatesPlugin::make()
->navigationGroup('Content') // Default: 'Email Templates'
->navigationIcon('heroicon-o-envelope-open') // Default: heroicon-o-envelope-open
->navigationSort(5) // Default: 1
->navigationBadge(true), // Default: true β shows template count badge
| Method | Type | Default | Description |
|---|---|---|---|
navigationGroup(string) |
string |
'Email Templates' |
The sidebar group label |
navigationIcon(string) |
string |
heroicon-o-envelope-open |
Heroicon name for the nav item |
navigationSort(int) |
int |
1 |
Sort order within the nav group |
navigationBadge(bool) |
bool |
true |
Show or hide the record-count badge |
To enable the Dark Theme and Image Uploads in the Unlayer editor, you must set a valid Unlayer Project ID. Without it, the editor runs in anonymous demo mode and custom appearances are disabled.
.env:UNLAYER_PROJECT_ID=YOUR_PROJECT_ID
Note: The editor works perfectly for designing and saving templates even without a Project ID. The only feature youβll miss is dark mode. That said, itβs better to create a free developer account and use your own Project ID to ensure everything is properly configured and ready for long-term use.
Navigate to Email Templates in your Filament panel and click New Email Template.
order.success, auth.welcome). This is what you'll reference in your Mailables.{{placeholders}} are both supported.Add the HasEmailTemplate trait to any standard Laravel Mailable:
namespace App\Mail;
use Illuminate\Mail\Mailable;
use NoteBrainsLab\FilamentEmailTemplates\Traits\HasEmailTemplate;
class OrderConfirmation extends Mailable
{
use HasEmailTemplate;
public function __construct(public $order)
{
// Reference the 'key' you set in the Filament panel
$this->templateKey = 'order.success';
// Pass the variables your design uses as {{placeholders}}
$this->templateVariables = [
'user_name' => $this->order->customer_name,
'order_total' => $this->order->total,
];
}
}
Then send it as any standard Mailable:
Mail::to($user)->send(new OrderConfirmation($order));
In the Unlayer editor, add {{variable_name}} placeholders as text anywhere in your design. The trait will replace them safely at send time.
Hello {{user_name}}, your order of ${{order_total}} has been confirmed!
The subject line also supports placeholders and full Blade syntax:
Your Order #{{order_total}} is Confirmed β Thanks {{user_name}}!
The Unlayer editor fully syncs with Filament's dark mode toggle:
modern_dark and modern_light themes.#161616 (dark) and #f9f9f9 (light) dynamically.Dark mode requires a valid
UNLAYER_PROJECT_IDto work.
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^11.0, ^12.0, or ^13.0 |
| Filament | ^4.0 or ^5.0 |
The MIT License (MIT). Please see the License File for more information.
How can I help you explore Laravel packages today?