solution-forest / filament-unlayer
This is my package filament-unlayer
Package info
github.com/solutionforest/filament-unlayer
pkg:composer/solution-forest/filament-unlayer
Requires
- php: ^8.1
- filament/forms: ^4.0|^5.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^10.3
- pestphp/pest: ^3.8|^4.0
- pestphp/pest-plugin-laravel: ^3.2|^4.0
- pestphp/pest-plugin-livewire: ^3.0|^4.0
Conflicts
- filament/filament: <4.0.0-beta
This package is not auto-updated.
Last update: 2026-04-30 08:29:01 UTC
README
Filament Unlayer
Filament Unlayer is a custom field package designed for Filaletter, the Filament Newsletter plugin. It enables rich, drag-and-drop email template editing within your FilamentPHP admin panel, powered by the Unlayer editor.
With Filament Unlayer, you can:
- Build and edit email templates visually with Unlayer’s intuitive interface
- Store both the HTML and JSON design data for each template
- Reuse, duplicate, and manage templates for different campaigns or use cases
- Integrate seamlessly as a custom field in any FilamentPHP resource or form
- Export clean, production-ready HTML for sending with your preferred email service
- Customize the Unlayer editor’s appearance and options to fit your workflow
Features
- Drag-and-drop email builder: Integrates Unlayer for visual email design.
- Saves both HTML and JSON design data: Store and reuse templates flexibly.
- Easy integration: Use as a custom field in your Filament forms.
- Export HTML: Easily extract the generated HTML for sending.
Installation
| Filament Version | Filament Newsletter Version |
|---|---|
| v3.x | v0.x |
| v4.x | v2.x |
| v5.x | >= v2.0.7 |
Install via Composer:
composer require solution-forest/filament-unlayer php artisan filament:assets
Publish the config file (optional):
php artisan vendor:publish --tag="filament-unlayer-config"
Publish the views (optional):
php artisan vendor:publish --tag="filament-unlayer-views"
Usage
1. Prepare Your Database
First, ensure your table has a json column to store the Unlayer design and HTML. For example, in a migration:
$table->json('content');
2. Add the Unlayer Field to Your Filament Form
Add the Unlayer field to your resource or form:
use SolutionForest\FilamentUnlayer\FilamentUnlayer; FilamentUnlayer::make('content');
This field will save both the HTML and the Unlayer design JSON into your content column.
3. Exporting HTML
If you want to store only the HTML in a separate field, you can mount the HTML state to another field:
FilamentUnlayer::make('json-content')->mountHtmlStateTo('data.content'); Hidden::make('content');
Or, extract the HTML from the field data before saving:
protected function mutateFormDataBeforeSave(array $data): array { $data['content'] = $data['json-content']['html']; return $data; }
Testing
composer test
Changelog
See CHANGELOG for recent updates.
Contributing
See CONTRIBUTING for details.
Security
See security policy for reporting vulnerabilities.
Credits
License
MIT. See License File for details.
