bundana / laravel-sms-notify
A flexible and powerful SMS notification package for Laravel applications
Fund package maintenance!
bundana
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- pestphp/pest: ^2.34
- pestphp/pest-plugin-phpunit: ^2.0
This package is auto-updated.
Last update: 2025-06-13 19:05:30 UTC
README
A fluent API for sending SMS via multiple providers in Laravel. This package supports Mnotify, Hubtel, and Nalo SMS providers.
Installation
You can install the package via composer:
composer require Bundana/laravel-sms-notify
After installing the package, publish the configuration file:
php artisan vendor:publish --provider="Bundana\LaravelSmsNotify\SmsServiceProvider" --tag="config"
Configuration
Add the following environment variables to your .env
file:
SMS_PROVIDER=mnotify # Mnotify Configuration MNOTIFY_API_KEY=your_api_key MNOTIFY_SENDER_ID=your_sender_id MNOTIFY_BASE_URL=https://api.mnotify.com/api/ # Hubtel Configuration HUBTEL_CLIENT_ID=your_client_id HUBTEL_CLIENT_SECRET=your_client_secret HUBTEL_SENDER_ID=your_sender_id HUBTEL_BASE_URL=https://smsc.hubtel.com/v1/ # Nalo Configuration NALO_API_KEY=your_api_key NALO_SENDER_ID=your_sender_id NALO_BASE_URL=https://sms.nalosolutions.com/api/
Usage
Basic Usage
use Bundana\LaravelSmsNotify\Facades\Sms; // Send an immediate SMS Sms::to('+233201234567') ->message('Hello from Laravel!') ->send(); // Send with a specific provider Sms::to('+233201234567') ->provider('hubtel') ->message('Hello from Laravel!') ->from('SCEF') ->send();
Queued SMS
// Queue an SMS for later processing Sms::to('+233201234567') ->message('This will be queued') ->queue() ->send();
Scheduled SMS
// Schedule an SMS for future delivery Sms::to('+233201234567') ->message('This will be sent in 5 minutes') ->queue() ->schedule(now()->addMinutes(5)) ->send();
Available Methods
to(string $number)
: Set the recipient's phone numbermessage(string $message)
: Set the message contentfrom(string $sender)
: Set the sender's name or numberprovider(string $provider)
: Set the SMS provider (mnotify, hubtel, nalo)queue()
: Mark the message for queuingschedule(\DateTimeInterface $time)
: Schedule the message for future deliverysend()
: Send the message
Testing
composer test
Security
If you discover any security related issues, please email Bundana@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.