How to Send SMS, OTP & DLT Messages in Laravel with Fast2SMS
SMS is still one of the most reliable channels to reach users instantly. Whether it’s OTP verification, transaction alerts, delivery updates, or marketing campaigns — SMS ensures high visibility, especially in India where mobile penetration is massive.

But integrating SMS in Laravel isn’t always clean. Most providers hand you a raw REST API and leave you to figure out the rest — repetitive boilerplate, manually wiring up queues and retries, and code that doesn’t feel Laravel-native at all.
That’s exactly the problem laravel-fast2sms solves.
What Is Laravel Fast2SMS?
Laravel Fast2SMS is an open-source package that integrates seamlessly with the Fast2SMS API — designed to make SMS sending simple, fluent, and Laravel-friendly, so you can focus on your app instead of SMS plumbing.
What it lets you do
- ✅ Send Quick SMS, OTP, and DLT messages
- ✅ Integrate with Laravel queues & scheduling
- ✅ Monitor your wallet balance from within your app
- ✅ Use SMS as a Laravel Notification channel
- ✅ Write clean, chainable, expressive code — the Laravel way
Who it’s for
This package is ideal for:
- Authentication systems — OTP-based login and 2FA
- E-commerce stores — order confirmations, delivery updates
- FinTech apps — instant transaction alerts
- SaaS platforms — scheduled reminders, automated notifications
If your app targets Indian users, this package will save you hours of integration work.
Requirements
- PHP 8.3+
- Laravel 12+
- A Fast2SMS account with an API key
Step 1: Install the Package
composer require itxshakil/laravel-fast2sms
Supports Laravel auto-discovery — no manual provider registration needed.
Step 2: Configure Fast2SMS
Publish the config file:
php artisan vendor:publish --tag=fast2sms-config
Then update your .env:
FAST2SMS_API_KEY="YOUR_API_KEY"
FAST2SMS_DEFAULT_SENDER_ID="FSTSMS"
FAST2SMS_DEFAULT_ROUTE="dlt"
Step 3: Sending SMS
Quick SMS
use Shakil\Fast2sms\Facades\Fast2sms;
use Shakil\Fast2sms\Enums\SmsLanguage;
// English
Fast2sms::quick('9999999999', 'Hello, this is a Quick SMS!');
// Unicode (Hindi, etc.)
Fast2sms::quick('9999999999', 'नमस्ते! यह एक क्विक एसएमएस है।', SmsLanguage::UNICODE);
DLT SMS
For marketing and transactional messages that require TRAI-registered templates:
use Shakil\Fast2sms\Facades\Fast2sms;
Fast2sms::dlt(
numbers: '9999999999',
templateId: 'YOUR_TEMPLATE_ID',
variablesValues: ['John Doe'],
senderId: 'YOUR_SENDER_ID'
);
OTP SMS
use Shakil\Fast2sms\Facades\Fast2sms;
Fast2sms::otp('9999999999', '123456');
Fluent Interface
For more control, use the chainable builder:
use Shakil\Fast2sms\Facades\Fast2sms;
use Shakil\Fast2sms\Enums\SmsRoute;
Fast2sms::to('9999999999')
->route(SmsRoute::DLT)
->senderId('YOUR_SENDER_ID')
->templateId('YOUR_TEMPLATE_ID')
->variables(['John Doe'])
->send();
Step 4: Extra Features
Check Wallet Balance
Monitor your SMS credits directly from your application:
$response = Fast2sms::checkBalance();
if ($response->success()) {
echo "Wallet Balance: {$response->balance}\n";
echo "SMS Count: {$response->smsCount}\n";
}
Queueing SMS
The package integrates with Laravel’s job queue system out of the box:
// Queue a Quick SMS
Fast2sms::quickQueue('9999999999', 'Hello from queue!');
// Queue a DLT SMS
Fast2sms::dltQueue(
numbers: '9999999999',
templateId: 'YOUR_TEMPLATE_ID',
variablesValues: ['John Doe'],
senderId: 'YOUR_SENDER_ID'
);
// Queue an OTP SMS
Fast2sms::otpQueue('9999999999', '123456');
For advanced queue control — custom connections, queue names, delays:
Fast2sms::to('9999999999')
->message('Test message')
->onConnection('redis')
->onQueue('sms')
->delay(now()->addMinutes(10))
->queue();
Laravel Notifications Channel
Integrate SMS seamlessly into Laravel’s Notification system:
use Illuminate\Notifications\Notification;
use Shakil\Fast2sms\Facades\Fast2sms;
use Shakil\Fast2sms\Enums\SmsRoute;
class LowSmsBalanceNotification extends Notification
{
public function __construct(
protected float $balance,
protected float $threshold
) {}
public function via($notifiable): array
{
return ['fast2sms'];
}
public function toFast2sms($notifiable)
{
return Fast2sms::to($notifiable->phone)
->message("Low SMS balance: {$this->balance}. Threshold: {$this->threshold}.")
->route(SmsRoute::QUICK)
->send();
}
}
Dispatching the notification:
Notification::route('fast2sms', '9999999999')
->notify(new LowSmsBalanceNotification(500, 1000));
Step 5: Error Handling
Always wrap SMS calls in a try-catch to handle failures gracefully:
use Shakil\Fast2sms\Exceptions\Fast2smsException;
try {
Fast2sms::quick('9999999999', 'Hello World');
} catch (Fast2smsException $e) {
logger()->error("SMS failed: " . $e->getMessage());
}
Why Use laravel-fast2sms?
| Feature | Detail |
|---|---|
| 🚀 Fluent API | Expressive, chainable syntax — reads like Laravel |
| 🎯 All SMS types | Quick, DLT, OTP — all covered |
| ⏳ Queue support | Native Laravel jobs, connections, delays |
| 🔒 DLT compliant | Works with TRAI-registered templates |
| 📡 Balance monitoring | Check credits without leaving your app |
| 📱 Notifications | Plugs into Laravel’s notification system |
| 📦 Lightweight | No unnecessary dependencies |
| 🆓 Open source | MIT licensed, free forever |
Roadmap
What’s coming next:
- ✅ PHP 8.5 support (once released)
- ✅ Webhook handling for delivery receipts
Conclusion
With laravel-fast2sms, you can integrate Fast2SMS into Laravel in minutes — sending OTPs, notifications, or bulk DLT messages with queue support, balance monitoring, and a fluent API that feels right at home in any Laravel codebase.
👉 Try it today: github.com/itxshakil/laravel-fast2sms
⭐ If you find it useful, star the repo — it helps more Laravel developers discover it.
Found a bug or want to contribute? PRs and issues are always welcome.





