Laravel Packages

Laravel SMS Catcher: A Local Dashboard for SMS Notifications

Published
Laravel SMS Catcher: A Local Dashboard for SMS Notifications image

Laravel SMS Catcher is a local development helper by Michal Skogemann that captures outgoing SMS notifications. Much like Mailpit does for email, it gives you a visual dashboard to inspect the text body and metadata of your SMS messages while working locally.

Main Features

  • Phone-style preview — Displays text inside a virtual device mockup with a selector to check how line wrapping looks on different screen widths.
  • Environment-safe defaults — Blocks the dashboard on production environments, running only in local or debug modes.
  • Customizable routing — Lets you customize the dashboard URL path and wrap routes with your own middleware.
  • Flat-file storage — Stores messages in a local JSON file in your logs directory, bypassing the need for database tables or migrations.
  • Inbox management — Clears individual messages or wipes the entire inbox from the dashboard.

How It Works

The catcher hooks into Laravel's notification system. When you send a notification via the sms channel, the package intercepts it by calling toSms on the notification class. It then writes the sender, recipient, body, and timestamp to storage/logs/sms-catcher.json.

Writing to a flat JSON file means there are no database tables or migrations to set up. Since Laravel excludes the storage/logs directory from git by default, your test messages won't clutter your repository.

Dashboard and Phone Previews

The dashboard comes with light and dark themes. Clicking a message in the sidebar opens a detail view with a phone-style mockup. A device selector dropdown lets you switch between screen sizes to see how text wrapping, spacing, and line breaks look on different devices.

Screenshot of the SMS Catcher Message Detail view
SMS Catcher Message Detail view

Configuration

Out of the box, the inbox is available at /sms-catcher whenever your app runs in the local environment or has debug mode turned on. If you need to change these settings, you can publish the configuration file:

php artisan vendor:publish --tag=sms-catcher-config

The resulting config/sms-catcher.php file lets you:

  • Toggle the catcher using the SMS_CATCHER_ENABLED env variable.
  • Set a custom URL prefix (route.prefix).
  • Adjust the middleware stack (route.middleware).
  • Change where the messages are stored (storage_path).

Installation

You can install the package as a development dependency via Composer:

composer require --dev michal78/laravel-sms-catcher

To capture your messages, make sure your notification classes have a toSms() method that returns a string, array, or an object containing the message body.

You can inspect the source code, report issues, and read the documentation on the GitHub repository.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Sponsored

masteringlaravel logo
Laravel Code Review

Get expert guidance in a few days with a Laravel code review

Visit Laravel Code Review

The latest

View all →
Laravel monitoring that doesn't bill you by your traffic image

Laravel monitoring that doesn't bill you by your traffic

Read article
Mock PHP Classes in Tests With the Double Library image

Mock PHP Classes in Tests With the Double Library

Read article
Laravel Discount: Coupon Codes, Usage Limits, and Stacking image

Laravel Discount: Coupon Codes, Usage Limits, and Stacking

Read article
Laravel Truss: Live Interactive Database ER Diagrams image

Laravel Truss: Live Interactive Database ER Diagrams

Read article
Laravel artisan dev: Run Server, Queue, Logs, and Vite image

Laravel artisan dev: Run Server, Queue, Logs, and Vite

Read article
Validate and Convert HEIC Images in Laravel image

Validate and Convert HEIC Images in Laravel

Read article