Hosmel Quintana
Laravel Audit LogsLaravel Message Preview
Introduction
Installation
Configuration
Basic usage
Previewing Messages
Sample Data
Notifications
Advanced usage
Authorization
View on GitHub

Introduction

Preview Laravel mailables and mail notifications in the browser.

Laravel Message Preview finds the mailables and mail notifications in your application and renders them in the browser. Each preview shows the message Laravel would send: its subject, addresses, attachments, and HTML and plain-text bodies.

Quick start

After installing the package, open /message-preview. Messages with constructor arguments get sample data from previewConfig():

php
use App\Models\Order;
use HosmelQ\MessagePreview\Support\PreviewConfig;
use Illuminate\Mail\Mailable;

final class OrderShipped extends Mailable
{
    public function __construct(public Order $order) {}

    public static function previewConfig(): PreviewConfig
    {
        return PreviewConfig::configure()
            ->withMessage(fn (): self => new self(Order::factory()->make()));
    }
}

Next steps

  • Previewing messages explains which classes are listed.
  • Sample data adds named variants to a message.
  • Notifications sets the notifiable of a notification.
Installation