This is a Laravel library to send SMS and switch between multiple SMS Gateways.
You can install the package via composer:
composer require khbd/laravel-sms-bdThe package will register itself automatically.
Then publish the package configuration file
php artisan vendor:publish --provider=Khbd\LaravelSmsBD\SMSServiceProvideror
php artisan vendor:publish --provider=Khbd\LaravelSmsBD\SMSServiceProvider --tag="sms"For store sms log in db run migration
php artisan migrateCheck the config file of all variables required, and then
(new SMS())->send('01945602071','Test SMS');or using Facade
SMS::send('01945602071','Test SMS');or using helper
sms()->send('01945602071','Test SMS');use command
php artisan make:gateway MyGatewayA class MyGateway.php will be generated under App/Gateways folder.
The class extends the SMSInterface
Remember to map your gateway in the sms config file.
Apart from declaring your default gateway on the sms config or env files, you can also change the gateway you want to use on the fly. e.g:
SMS::gateway('mygateway')->send('01945602071','Test SMS');SMS::getBalance();
//or
SMS::gateway('mygateway')->getBalance();sms()->getDeliveryReports(Request $request);
//or
sms()->gateway('mygateway')->getDeliveryReports(Request $request);Currently Default SMS Gateway is Bangladesh SMS
So .env config is following -
BANGLADESH_SMS_BASE_URL = 'http://bangladeshsms.com'
BANGLADESH_SMS_USERNAME = 'username'
BANGLADESH_SMS_API_KEY = 'api_key'
BANGLADESH_SMS_FROM = 'api_provided_number'
SMS_ACTIVATE = true // true = if you want to enable sms sending functionality
SMS_LOG = true // true = if you want to save sms log in databaseIf you use teletalk sms gateway, please set following config value in .env file of config/sms.php file -
TELETALK_SMS_BASE_URL = 'http://bulkmsg.teletalk.com.bd'
TELETALK_SMS_USERNAME = 'APIUsername'
TELETALK_SMS_PASSWORD = 'APIPassword'
TELETALK_SMS_ACODE = 'YourA-Code'
TELETALK_SMS_MASKING = 'MaskingNumber'
SMS_ACTIVATE = true // true = if you want to enable sms sending functionality
SMS_LOG = true // true = if you want to save sms log in databaseSuggestions, pull requests , bug reporting and code improvements are all welcome. Feel free.
Write Tests
The MIT License (MIT). Please see License File for more information.