New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

haberkamp/letterbook

A Storybook for Laravel emails - browse and preview mailables with Inertia, React and Tailwind.
511 1
Install
composer require haberkamp/letterbook:dev-main
PHP:^8.3
License:MIT
Last Updated:Oct 3, 2026
Links: GitHub  ·  Packagist
Maintainer: Haberkamp

Letterbook

A better way to develop emails. Similar to Storybook, but for your Laravel mailables.

Installation

Install the package via Composer:

composer require haberkamp/letterbook

Publish the config file:

php artisan vendor:publish --tag=letterbook-config

Publish the built frontend assets:

php artisan vendor:publish --tag=letterbook-assets

Configuration

The published config/letterbook.php file contains the following options:

return [
    // URL path where the Letterbook UI is served.
    'path' => env('LETTERBOOK_PATH', 'letterbook'),

    // Middleware applied to the Letterbook routes.
    'middleware' => ['web'],

    // Path to the file (or directory) where your email stories are defined.
    'stories' => app_path('Mail/stories.php'),

    // Gate name or closure to guard the UI. Return false to deny access.
    'gate' => null,
];

Usage

Once installed, visit /letterbook (or your configured path) in your browser to browse your email stories. You can preview the rendered HTML and plain-text output of each mailable and send the email to any address using the built-in send form.

Defining Stories

Register your mailables as stories in the file configured via letterbook.stories (defaults to app/Mail/stories.php):

<?php

use App\Mail\OrderShipped;
use App\Mail\WelcomeEmail;
use Letterbook\Letterbook\Support\Facades\Letterbook;

Letterbook::story('Welcome Email', fn () => new WelcomeEmail(user: $user))
    ->description('Sent after a user registers.');

Letterbook::story('Order Shipped', fn () => new OrderShipped($order), group: 'Orders');

Grouping and Variants

Pass a group to organize stories in the sidebar and add variants to show the same email in different states:

$story = Letterbook::story('Invoice', fn () => new InvoiceMail($unpaidInvoice), group: 'Billing');

$story->variant('Paid', fn () => new InvoiceMail($paidInvoice));

Restricting Access

Guard the UI behind a closure in production:

// config/letterbook.php
'gate' => fn ($request) => app()->environment('local'),

Contributing

See CONTRIBUTING.md.

License

Letterbook is open-sourced software licensed under the MIT license.

Related Packages

capsulescodes/inertia-mailable

Seamlessly craft dynamic and reusable email templates using Inertia

55,785 28
lattice-php/lattice

Server-driven React components for Laravel and Inertia.

9,713 0
mscode-pl/laravel-react-email

Build Laravel mailables with react-email

1,081 0
nwanguma/atlas

Laravel React Inertia Tailwind starter kit

275 90
leafs/inertia

Leaf PHP adapter for inertia JS

1,454 1