46
Send Message to Bangladeshi Mobile Using Laravel
LaravelBDSms is a package for sending sms/otp to Bangladeshi mobile number. This package is built specially for laravel. Using this package it is possible to send message using several Bangladeshi SMS Gateways such as....
BDBulkSMS
BulkSMSBD
Dianahost
MDLSMS
Metronet
OnnoRokomSMS
SSLSms
Installation
composer require xenon/laravelbdsms
Currently this package supports laravel 5.4*, 5.6*, 6., 7. and 8.* also.
As you have installed laravelbdsms, you are now able to use this package anywhere in your project. See the below example for sending sms DianaHost Sms Gateway
use Xenon\LaravelBDSms\Provider\DianaHost;
use Xenon\LaravelBDSms\Sender;
$sender = Sender::getInstance();
$sender->setProvider(DianaHost::class);
$sender->setMobile('017XXYYZZAA');
$sender->setMessage('helloooooooo boss!');
$sender->setConfig(
[
'api_key' => 'your_api_goes_here',
'type' => 'text',
'senderid' => 'sender_id'
]
);
$status = $sender->send();
use Xenon\LaravelBDSms\Provider\Ssl;
use Xenon\LaravelBDSms\Sender;
$sender = Sender::getInstance();
$sender->setProvider(Ssl::class);
$sender->setMobile('017XXYYZZAA');
$sender->setMessage('helloooooooo boss!');
$sender->setConfig(
[
'api_token' => 'api token goes here',
'sid' => 'text',
'csms_id' => 'sender_id'
]
);
$status = $sender->send();
Note: Setting configuration for sending sms is very necessary . If you don't configure instance before calling send() method , you will get exception for passing using setConfig() method.
If you benefitted using this package you are highly requested to follow me at Github
46