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.
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_ENABLEDenv 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.
0 Comments
Log in to join the conversation.No comments yet. Be the first to share your thoughts.