This guide covers all SMS sending options available in Laravel Fast2SMS.
| Route | Enum | Use Case |
|---|---|---|
| Quick | SmsRoute::QUICK |
Promotional / general messages |
| OTP | SmsRoute::OTP |
One-time passwords |
| DLT | SmsRoute::DLT |
Transactional messages (DLT registered) |
| DLT Manual | SmsRoute::DLT_MANUAL |
DLT with manual template variables |
Send a simple message without DLT registration:
use Shakil\Fast2sms\Facades\Fast2sms;
$response = Fast2sms::quick(
numbers: '9876543210',
message: 'Hello from Fast2SMS!',
);
Send a one-time password using a pre-approved OTP template:
$response = Fast2sms::otp(
numbers: '9876543210',
otpValue: '123456',
);
Send a DLT-registered transactional message:
$response = Fast2sms::dlt(
numbers: ['9876543210', '9123456789'],
templateId: 'your_dlt_template_id',
variablesValues: 'Your order #1234 has been shipped.',
senderId: 'MYSHOP',
);
$response = Fast2sms::dlt(
numbers: '9876543210',
templateId: 'your_template_id',
variablesValues: ['John', '654321'],
senderId: 'MYAPP',
);
Flash SMS appears directly on the recipient's screen without being stored:
$response = Fast2sms::to('9876543210')
->message('This is a flash message!')
->flash()
->send();
Pass an array of numbers to send to multiple recipients in one API call:
$response = Fast2sms::quick(
numbers: ['9876543210', '9123456789', '9000000001'],
message: 'Broadcast message to all users',
);
Note: Fast2SMS supports up to 1000 numbers per API call.
All send methods return an SmsResponse object:
$response = Fast2sms::quick(numbers: '9876543210', message: 'Hello!');
if ($response->isSuccess()) {
echo 'Sent! Request ID: ' . $response->requestId;
} else {
echo 'Failed: ' . $response->message;
}
SmsResponse Properties| Property | Type | Description |
|---|---|---|
isSuccess() |
bool |
Whether the send was accepted |
requestId |
string|null |
Unique request ID from Fast2SMS |
message |
string |
API response message |
data |
array |
Raw response data |
For notification-style usage, use the fluent SmsMessage builder:
use Shakil\Fast2sms\Enums\SmsRoute;
use Shakil\Fast2sms\Notifications\Messages\SmsMessage;
$message = SmsMessage::create('Your OTP is 123456')
->withRoute(SmsRoute::QUICK)
->withNumbers(['9876543210', '9123456789']);
Check your remaining SMS balance:
$balance = Fast2sms::checkBalance();
echo 'Balance: ₹' . $balance->balance;
Retrieve your DLT registration details:
use Shakil\Fast2sms\Enums\DltManagerType;
$dlt = Fast2sms::dltManager(DltManagerType::SENDER);
How can I help you explore Laravel packages today?