jeffersongoncalves/laravel-mail-editor
A Laravel package for editing mail templates directly from your application. Customize email views, manage content, and preview messages without touching code, with simple integration for admin panels and existing mail workflows.
The pitch is simple: it is a block-based email template engine that renders to the HTML you would otherwise hand-write in Blade and regret. You get a database-backed template, an editor for non-developers, and a single send call from your app code.
composer require jeffersongoncalves/laravel-mail-editor
Then, in order:
mail_editor_-prefixed names that are worth confirming won't collide.Mail::template($slug, $variables). Start with a single transactional email (order confirmation, password reset) rather than a campaign — you will hit every sharp edge in under an hour and the blast radius is a real user who expects the mail.php artisan list — the release notes mention Artisan commands without naming them. Grep the output for the package's namespace; expect import/export, publish/seed, and probably a render or preview command.First real use case: replace one Blade email that marketing keeps asking you to tweak. That is the value proposition in one sentence, and it is the right scope for evaluating whether the package earns a place in the stack.
Wrap the facade call in a Mailable. Mail::template() is convenient, but a Mailable class keeps the template slug and its variable contract in one typed place, gives you ->onQueue(), and makes the email testable without the editor UI. Treat the slug plus the variable array as an API consumed by the template author — a change on either side breaks the other.
Make the variable contract explicit. Variables support fallbacks, conditionals and loops, which is great for authors and dangerous for you: a missing key renders an empty string rather than throwing. Build a small DTO or toMailVariables() method per Mailable and assert its shape in a unit test. This is the single highest-value habit with any template engine that tolerates unknowns.
Version control the templates via JSON export. The review workflow and version history live in the database, which means they are not in your repo and not in your PR diffs. Export templates to JSON, commit them, and import on deploy. Do a dry run against staging first and know whether import merges or overwrites before you point it at production.
Respect the draft → review → publish lifecycle, and confirm what renders. Before wiring this into production, check which version Mail::template() resolves — published, latest, or a passed-in version. Then make sure your preview route (auth-gated, internal only) renders the draft while the send path renders the published one. Confusing the two is how half-finished copy reaches customers.
A/B variants need assignment logic you own. The package gives you variants; it does not give you analytics or a deterministic bucketing strategy. Decide the split in your app (hash of user ID, a column on the user, a feature flag), log which variant went out alongside the send, and keep the variant key stable per recipient so a retry does not flip them.
Brand kits and themes for multi-tenant. If this is a SaaS, one template set plus per-tenant brand kits is a far better shape than duplicating templates per tenant. Establish and document the cascade order (block styles → theme → brand kit → base defaults) early; retrofitting it after a hundred templates exist is painful.
Test the output, not the intent. Snapshot the rendered HTML and the plain-text version in a test. Assert that Outlook VML markup is present for buttons, that links carry your UTM parameters, and that a conditional branch flips correctly with and without a variable set.
Queue the send. Rendering tables and inline CSS is not free. The Mailable should always be queued in production.
php artisan config:cache after config edits, and remember compiled views may need clearing after theme updates.{{ year }} or {{ company_name }} injected everywhere). Registering a global variable resolver beats asking every author to remember a fallback.Overall: a strong fit if non-developers need to own email content and you want the output to be someone else's problem. Keep the variable contract in typed code, keep templates in JSON in git, and it will pay for itself quickly.
How can I help you explore Laravel packages today?