Laravel SMS Catcher: A Local Dashboard for SMS Notifications
Laravel Composer Pacakge #Laravel #SMS #Local Development #Notifications #Composer Package

Laravel SMS Catcher: A Local Dashboard for SMS Notifications

3 min read Mohamed Said Mohamed Said

What Is Laravel SMS Catcher?

Laravel SMS Catcher is a local development helper by Michal Skogemann that captures outgoing SMS notifications before they reach a real carrier. Think of it as the SMS equivalent of Mailpit: instead of sending texts to actual phone numbers during development, the package intercepts them and displays the content in a clean visual dashboard.

Installation

Install the package as a development dependency via Composer:

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

Once installed, the dashboard is immediately available at /sms-catcher whenever your app runs in the local environment or has debug mode enabled. No migrations, no extra services.

How It Works

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

Using a flat JSON file has two practical benefits:

  • No database setup — there are no tables or migrations to manage.
  • Git-friendly — Laravel excludes storage/logs from version control by default, so test messages never end up in your repository.

For the package to capture a notification, your notification class must implement a toSms() method that returns a string, array, or an object containing the message body.

Dashboard Features

Phone-Style Previews

Clicking a message in the sidebar opens a detail view with a phone-style mockup. A device selector dropdown lets you switch between screen widths to check how text wrapping, spacing, and line breaks render on different devices — useful for catching truncation issues before going to production.

Light and Dark Themes

The dashboard ships with both light and dark themes, so it fits comfortably alongside whatever IDE or terminal setup you prefer.

Inbox Management

You can clear individual messages or wipe the entire inbox directly from the dashboard, keeping your local log tidy during active development.

Environment Safety

The dashboard is blocked on production environments by default. It only activates when the app is running in local mode or has debug mode turned on, reducing the risk of accidentally exposing it.

Configuration

If the defaults don't suit your project, publish the configuration file:

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

The resulting config/sms-catcher.php file exposes the following options:

  • SMS_CATCHER_ENABLED — toggle the catcher via an environment variable.
  • route.prefix — set a custom URL path for the dashboard.
  • route.middleware — wrap the dashboard routes with your own middleware.
  • storage_path — change where the JSON message file is written.

Key Takeaways

  • Drop-in SMS interception for local Laravel development, similar to how Mailpit handles email.
  • Stores messages in a flat JSON file — no migrations or database tables needed.
  • Phone-style mockup with a device selector helps you verify message formatting across screen sizes.
  • Production-safe by default; only active in local environment or debug mode.
  • Fully configurable URL prefix, middleware, and storage path via a published config file.

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


Source: Laravel News — Laravel SMS Catcher: A Local Dashboard for SMS Notifications

Found this useful?

Frequently Asked Questions

3 questions
Q01 Does Laravel SMS Catcher require a database or migrations?
No. The package stores all captured messages in a flat JSON file located at `storage/logs/sms-catcher.json`, so there are no database tables or migrations to set up.
Q02 Will the SMS Catcher dashboard be accessible in production?
No. By default the dashboard is blocked on production environments and only activates when the application runs in `local` mode or has debug mode enabled. You can also toggle it explicitly via the `SMS_CATCHER_ENABLED` environment variable.
Q03 What does my notification class need to implement for SMS Catcher to work?
Your notification class must have a `toSms()` method that returns a string, array, or an object containing the message body. The package calls this method to intercept the outgoing SMS.

Continue reading

More Articles

View all