Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mailbook Laravel Package

xammie/mailbook

Laravel dev tool to preview and inspect Mailables and Notifications without triggering them in your app. Register emails in a generated routes/mailbook.php file (with DI or closures) and browse previews at /mailbook.

View on GitHub
Deep Wiki
Context7

✉️ Laravel Mail Explorer

Frequently asked questions about Mailbook
How do I install Mailbook for Laravel without breaking production?
Run `composer require --dev xammie/mailbook` followed by `php artisan mailbook:install`. The package is dev-only and won’t affect production routes or workflows. Always use `--dev` to avoid accidental deployment.
Can Mailbook preview ShouldQueue mailables or notifications?
Yes, Mailbook supports queued mailables/notifications. The package handles queue jobs internally during preview, but test edge cases like delayed jobs or retries. Version 1.8.4+ includes fixes for queue integration.
Does Mailbook work with Laravel’s testing helpers like Mail::fake()?
Mailbook is designed to complement Laravel’s testing stack. It won’t interfere with `Mail::fake()` or `Notification::fake()`, but you can use it alongside them for manual inspection during development or CI.
How do I register a Mailable with custom parameters in routes/mailbook.php?
Use a closure to pass dynamic data. For example: `Mailbook::add(function (): WelcomeMail { return new WelcomeMail(User::factory()->create()); })`. Dependency injection works too: `Mailbook::add(function (User $user): WelcomeMail { return new WelcomeMail($user); })`.
Will Mailbook slow down my CI/CD pipeline due to database rollbacks?
Mailbook includes optional database rollback to prevent side effects, but it can impact CI speed. Benchmark rollback duration in your staging environment. Disable rollback in `config/mailbook.php` if your tests don’t modify the database.
Can I customize the Mailbook UI or styling?
Yes, publish the views with `php artisan vendor:publish --tag=mailbook-views` and modify the Tailwind CSS classes. Isolate custom styles to avoid conflicts with your app’s global CSS. Node.js is required for asset compilation if you customize the frontend.
How do I prevent Mailbook from accidentally sending emails in production?
Mailbook is dev-only by design, but add a feature flag check like `if (app()->environment('local'))` around `Mailbook::add()` calls. Also, block `/mailbook` routes in production via middleware or CI/CD gates.
Does Mailbook support localization for multi-language emails?
Yes, Mailbook respects Laravel’s localization system. Use `app()->setLocale()` in your closure or pass a locale parameter to your Mailable/Notification. Test with `php artisan mailbook:install --locale=es` to preview localized versions.
What’s the difference between Mailbook and spatie/laravel-mail-preview?
Mailbook offers deeper Laravel integration (e.g., queue support, database rollback, and variant testing) and a more modular setup via `routes/mailbook.php`. Spatie’s package is simpler but lacks some advanced features like dependency injection in closures or CI-safe rollbacks.
How do I test email variants (e.g., '1 item' vs. '2 items') in CI?
Register variants in `routes/mailbook.php` using `Mailbook::add()->variant('key', $data)`. For CI, automate variant testing with a script that loops through predefined scenarios and asserts previews match expected outputs. Example: `php artisan mailbook:test --variants=order_confirmation,cancelled`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony