SMS Gateway service library in PHP. Multiple providers of Bangladesh in one library
sarahman/sms-service-with-bd-providers is a Laravel package for sms gateway service library in php. multiple providers of bangladesh in one library.
It currently has 0 GitHub stars and 13.352 downloads on Packagist (latest version 1.0.5).
Install it with composer require sarahman/sms-service-with-bd-providers.
Discover more Laravel packages by sarahman
or browse all Laravel packages to compare alternatives.
Last updated
Simple php library to interact with various SMS gateways to send SMS to the Bangladeshi mobile users with storing SMS request logs.
Please install this library with composer. Run the following composer command to add this library.
composer require sarahman/sms-service-with-bd-providers
Next, you need to install the service provider:
// app/config/app.php
.....
.....
'providers' => [
...
Sarahman\SmsService\SmsGatewayServiceProvider::class,
],
.....
.....
You can publish the config file with:
php artisan config:publish sarahman/sms-service-with-bd-providers
php artisan vendor:publish --provider="Sarahman\SmsService\ServiceProviderForLaravelRecent"
This is the contents of the published config file:
<?php
use Sarahman\SmsService\Client;
return [
'default' => [
'provider' => Client::PROVIDER_SSL,
],
'providers' => [
Client::PROVIDER_BANGLALINK => [
'url' => 'https://vas.banglalinkgsm.com/sendSMS/sendSMS',
'userID' => '',
'passwd' => '',
'sender' => '',
],
Client::PROVIDER_BD_WEB_HOST_24 => [
'url' => 'http://sms.bdwebhost24.com/smsapi',
'senderid' => '',
'api_key' => '',
'type' => 'text',
],
Client::PROVIDER_BOOM_CAST => [
'url' => 'http://api.boom-cast.com/boomcast/WebFramework/boomCastWebService/externalApiSendTextMessage.php',
'userName' => '',
'password' => '',
'MsgType' => 'TEXT',
'masking' => 'S.H.P.L',
],
Client::PROVIDER_BULK_SMS_BD => [
'url' => 'http://bulksmsbd.net/api/smsapi',
'api_key' => '',
'senderid' => '',
'type' => 'text',
],
Client::PROVIDER_ELITBUZZ => [
'url' => 'https://msg.elitbuzz-bd.com/smsapi',
'api_key' => '',
'senderid' => '',
'type' => 'text',
],
Client::PROVIDER_GRAMEENPHONE => [
'url' => 'https://cmp.grameenphone.com/gpcmpapi/messageplatform/controller.home',
'username' => '',
'password' => '',
'countrycode' => '880',
'cli' => '',
'apicode' => 1,
'messagetype' => 1, // 1: Text; 2: Flash; 3: Unicode (Bangla)
'messageid' => 0,
],
Client::PROVIDER_NOVOCOM => [
'url' => 'https://sms.novocom-bd.com/api/v2/SendSMS',
'ApiKey' => '',
'ClientId' => '',
'SenderId' => '',
],
Client::PROVIDER_PAYSTATION => [
'url' => 'https://sms.shl.com.bd/sendsms',
'user_id' => '',
'password' => '',
'type' => 'text',
],
Client::PROVIDER_ROBI => [
'url' => 'https://bmpws.robi.com.bd/ApacheGearWS/SendTextMessage',
'Username' => '',
'Password' => '',
'From' => '',
],
Client::PROVIDER_SSL => [
'url' => 'http://sms.sslwireless.com/pushapi',
'user' => '',
'pass' => '',
'sid' => '',
],
Client::PROVIDER_VALUE_FIRST => [
'url' => 'http://www.myvaluefirst.com/smpp/sendsms',
'username' => '',
'password' => '',
'from' => '',
'coding' => 3, // Unicode allows or not
],
],
'enable_api_call_logging' => false,
];
Now, you need to set the default credentials of various SMS providers which are needed to be used.
N.B.: This library directly depends on the package: sarahman/laravel-http-request-api-log. Please follow this link to know the usages of this package.
<?php
use Sarahman\SmsService\Client;
require "vendor/autoload.php";
// Instantiate with default config
$smsSender = new Client(Client::getProvider(Client::PROVIDER_SSL));
// Or instantiate with custom config
$smsSender = new Client(Client::getProvider(Client::PROVIDER_SSL, [
'user' => 'SSL_WIRELESS_USERNAME',
'pass' => 'SSL_WIRELESS_PASSWORD',
'sid' => 'SSL_WIRELESS_SID',
], 'SSL_WIRELESS_URL'));
try {
$response = $smsSender->send($mobile, $message);
if ($response['summary']['sent'] == $response['summary']['total']) {
// Do for the successful response.
} else {
// Do for the failed response.
}
} catch (Exception $e) {
echo $e->getMessage();
}
If you have your own SMS gateway and you provide API. Please build your own provider and send us pull request. We will add those here too.
To build your own provider, please follow src/Interfaces/ProviderInterface.php.
If you have any questions, please feel free to create an issue or write us at [email protected]
Feel free to contribute in this library. Add your own provider and send us pull requests.
If you discover any security related issues, please feel free to create an issue in the issue tracker or write us at [email protected].
The MIT License (MIT). Please see License File for more information.