SMS Package for Laravel - Simplify SMS integration with the SMS Gateway from sms.net.bd. Send message, check balance, get delivery reports, and manage SMS effortlessly in your Laravel applications.
sms_net_bd/sms is a Laravel package for sms package for laravel - simplify sms integration with the sms gateway from sms.net.bd. send message, check balance, get delivery reports, and manage sms effortlessly in your laravel applications..
It currently has 2 GitHub stars and 347 downloads on Packagist (latest version 1.0.4).
Install it with composer require sms_net_bd/sms.
Discover more Laravel packages by sms_net_bd
or browse all Laravel packages to compare alternatives.
Last updated
SMS Package for Laravel - Simplify SMS integration with the SMS Gateway from sms.bd. Send messages, check balance, get delivery reports, and manage SMS effortlessly in your Laravel applications.
The SMS Laravel package provides convenient access to the sms.bd REST API from php applications.
Sign up for a free sms.bd account today and get your API Key from our advanced SMS platform. Plus, enjoy free credits to try out your API in full!
Check out the other code examples
Install the package via Composer:
composer require sms_net_bd/sms
Set your SMS API key in the .env file:
SMS_NET_BD_API_KEY=your-api-key
Note: Ensure to replace placeholder your-api-key with your actual API key
use sms_net_bd\SMS; // Import the SMS class
// Create an instance of the class
$sms = new SMS();
try {
// Send Single SMS
$response = $sms->sendSMS(
"Hello, this is a test SMS!",
"01701010101"
);
// Send Multiple Recipients SMS
$response = $sms->sendSMS(
"Hello, this is a test SMS!",
"01701010101,+8801856666666,8801349494949,01500000000"
);
// Send SMS With Sender ID or Masking Name
$response = $sms->sendSMS(
"Hello, this is a test SMS!",
"01701010101",
"sms.net.bd"
);
// Schedule SMS for future delivery
$response = $sms->sendScheduledSMS(
"Scheduled SMS",
"8801701010101",
"2023-12-01 14:30:00" // Date format: YYYY-MM-DD HH:MM:SS
);
// Schedule SMS for future delivery with Sender ID
$response = $sms->sendScheduledSMS(
"Scheduled SMS with date",
"8801701010101",
"2023-12-01 14:30:00",
"sms.net.bd"
);
// Get SMS delivery report
$report = $sms->getReport($requestId);
// Check account balance
$balanceInfo = $sms->getBalance();
} catch (Exception $e) {
// handle $e->getMessage();
}
Note: Ensure to replace placeholder values with your phone numbers and messages.
The package provides better error handling. If the API response has an error (error != 0), an exception is thrown with the error message.
try {
$response = $sms->sendSMS('Invalid Recipient', '+invalid-number');
} catch (\Exception $e) {
// Handle the exception, log the error, or display a user-friendly message.
echo 'Error: ' . $e->getMessage();
}
This package is open-source software licensed under the MIT license
Contributions are welcome! Feel free to submit issues or open a pull request.
If you have any questions or feedback, please open an issue or open a pull request.