承接 xenon/laravelbdsms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xenon/laravelbdsms

Composer 安装命令:

composer require xenon/laravelbdsms

包简介

This is package for sending sms to Bangladeshi mobile numbers using laravel application

README 文档

README

Xenon\LaravelBDSms is a sms gateway package for sending text message to Bangladeshi mobile numbers using several gateways for Laravel Framework. You can watch installation process from youtube.

Installation

Step 1:

composer require xenon/laravelbdsms

Step 2:

Publish the package using command

php artisan vendor:publish --provider=Xenon\LaravelBDSms\LaravelBDSmsServiceProvider --tag="migrations"
php artisan vendor:publish --provider=Xenon\LaravelBDSms\LaravelBDSmsServiceProvider --tag="config"
php artisan migrate

Step 3:

Select Vendor From Console

Step 4:

php artisan config:cache && php artisan migrate

Usage

Simply use the facade

Note: For sending message using facade you must have to set .env credentials and set default provider; Find .env credentials for different providers from inside config/sms.php)

use Xenon\LaravelBDSms\Facades\SMS;

SMS::shoot('017XXYYZZAA', 'helloooooooo boss!');
SMS::shoot(['017XXYYZZAA','018XXYYZZAA'], 'helloooooooo boss!'); 

Or, with facade alias

use LaravelBDSms, SMS;

LaravelBDSms::shoot('017XXYYZZAA', 'helloooooooo boss!');
SMS::shoot('017XXYYZZAA', 'helloooooooo boss!');

Or, if you need to change the default provider on the fly

use Xenon\LaravelBDSms\Facades\SMS;
use Xenon\LaravelBDSms\Provider\Ssl;

$response = SMS::via(Ssl::class)->shoot('017XXYYZZAA', 'helloooooooo boss!');

Or, you can send message with queue. This queue will be added in your jobs table. Message will be sent as soon as job is run.

Make sure you have jobs table and other jobs related functionalities enabled

use Xenon\LaravelBDSms\Facades\SMS;
use Xenon\LaravelBDSms\Provider\Ssl;

SMS::shootWithQueue("01XXXXXXXXX",'test sms');
SMS::via(Ssl::class)->shootWithQueue("01XXXXXXXXX",'test sms');

Log Generate

You can generate log for every sms api request and save in database or file. For doing this. Follow below points

  1. Laravelbdsms stores log in two drivers(database, file). database is default. You can change it from config/sms.php
  2. Find and make true 'sms_log' => true,
  3. Be confirm you have completed step-2 and step-3
  4. For database driver
    1. Change log driver to log_driver =>'database' from config/sms.php
    2. Run command php artisan migrate. This will create lbs_log table in your database
  5. For file driver
    1. Change log driver to log_driver =>'file' from config/sms.php

Otherwise, if you want more control, you can use the underlying sender object. This will not touch any laravel facade or service provider.

Sample Code

SSLCommerz

use Xenon\LaravelBDSms\Provider\Ssl;
use Xenon\LaravelBDSms\Sender;

$sender = Sender::getInstance();
$sender->setProvider(Ssl::class); //change this provider class according to need
$sender->setMobile('017XXYYZZAA');
//$sender->setMobile(['017XXYYZZAA','018XXYYZZAA']);
$sender->setMessage('helloooooooo boss!');
$sender->setQueue(false); //set true if you want to sent sms from queue
$sender->setConfig(
   [
       'api_token' => 'api token goes here',
       'sid' => 'text',
       'csms_id' => 'sender_id'
   ]
);
$status = $sender->send();

----------Demo Response Using SSL-------------
array:6 [▼
  "status" => "response"
  "response" => "{"status":"FAILED","status_code":4003,"error_message":"IP Blacklisted"}"
  "provider" => "Xenon\LaravelBDSms\Provider\Ssl"
  "send_time" => "2021-07-06 08:03:23"
  "mobile" => "017XXYYZZAA"
  "message" => "helloooooooo boss!"
]
--------------------------------------------------

Sms Send Using Custom Gateway

We have tried to add most of the gateways of Bangladesh in this package as much as possible. But still if you don't find your expected gateway in this list, then use Custom Gateway using following code snippet.

use Xenon\LaravelBDSms\Provider\CustomGateway;
use Xenon\LaravelBDSms\Sender;

$sender = Sender::getInstance();
$sender->setProvider(CustomGateway::class);
$sender->setUrl('https://your_cusom_gateway_provider_url_here')
        ->setMethod('post')
        ->setHeaders([
            'Content-Type: application/json',
            'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        ], false);
$sender->setMobile('017XXYYZZAA');
$sender->setMessage('text message goes here');
$sender->setQueue(false);
//use required parameters based on your sms gateway. This will be changed according to need
$sender->setConfig(
    [
        'MsgType' => 'TEXT',
        'masking' => 'sample',
        'userName' => 'test_user',
        'message' => 'test message',
        'receiver' => '017xxxxxxxxxx',
    ]
);
echo $status = $sender->send();

Currently Supported Sms Gateways

Provider Credentials Required
For Sending SMS
Support Multiple Status Comment Contact
AjuraTech apikey, secretkey , callerID - Done Uses Reve SMS API (smpp.revesms.com) -
Adn api_key, api_secret, messsage_type, request_type - Done - -
Alpha api_key Yes Done - -
Banglalink userID, passwd , sender - Done - -
BDBulkSMS token - Done - -
BoomCast masking , userName , password - Done - -
BulksmsBD api_key,senderid - Done - -
BulkSmsDhaka api_key, callerID - Done - -
CustomGateway provide necessary token/api_key/others based on requirements - Done Be careful using this and test based on several scenario -
DhorolaSms apikey, sender - Done - -
DianaHost api_key, type, senderid - Done - -
DianaSMS ApiKey, ClientId, SenderId - Done - -
DurjoySoft ApiKey, SenderID - Done - -
EAmarseba x-app-key, x-app-secret, is_masking, masking_name - Done - -
ElitBuzz api_key, type, senderid, type - Done not tested yet in live -
Esms api_token, sender_id - Done - -
Grameenphone username, password, messagetype - Done not tested yet in live -
Infobip user, password - Done not tested yet in live -
Lpeek acode, apiKey, requestID, masking - Done - -
MDL api_key, type, senderid - Done not tested yet in live -
Metronet api_key, mask Done - -
MimSms ApiKey, UserName, SenderName - Done - -
Mobireach Username,Password, From - Done - -
Muthofun sender_id Yes Done - -
NovocomBD ApiKey , ClientId , SenderId - Done - -
OnnoRokomSMS userName, userPassword, type, maskName, campaignName - Done not tested yet in live -
QuickSms api_key, senderid, type,scheduledDateTime - Done not tested yet in live -
RedmoITSms api_token, sender_id - Support closed -
Reve SMS apikey, secretkey , callerID - Done Use AjuraTech provider for the Reve SMS -
SendMySms user, closed - Done tested in live
SmartLabSMS user, password, sender - Done - -
Sms4BD publickey, privatekey, type,sender, delay - Done - -
SmsBangladesh user, password, from - Done - -
SmsinBD api_token, senderid - Done -
SMS.net.bd api_key - Done -
SmsQ sender_id, client_id, api_key - Done -
SMSNet24 user_id, user_password, route_id(optional), sms_type_id(optional) - Done -
SmsNoc sender_id, bearer_token - Done -
SongBird apikey, secretkey, callerID - Done -
Sslsms api_token, sid, csms_id Yes Done - -
Tense user, password, campaign, masking - Done - -
TmssIct api_key, request_type, message_type, campaign_title Yes Done Endpoint: /api/v001/sent_sms (https://sms.tmssict.com) -
Twenty4BulkSms api_key, sender_id,user_email - Done - -
TwentyFourBulkSmsBD customer_id, api_key - Done - -
Trubosms api_token, sender_id - Done - -
Viatech api_key, mask - Done - -
WinText token, messagetype, ismasking, masking - Done - -
ZamanIT api_key, senderid,type - Done - -

Stargazers

Stargazers repo roster for @arif98741/laravelbdsms

Forkers

Forkers repo roster for @arif98741/laravelbdsms

Contributors


We are continuously working in this open source library for adding more Bangladeshi sms gateway. If you feel something is missing then make a issue regarding that. If you want to contribute in this library, then you are highly welcome to do that....

For clear documentation read this blog in Medium! and also you can download several sms providers documentations as pdf from this link!

Special thanks to
tusharkhan
tusher9352

xenon/laravelbdsms 适用场景与选型建议

xenon/laravelbdsms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.55k 次下载、GitHub Stars 达 151, 最近一次更新时间为 2021 年 06 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 xenon/laravelbdsms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 xenon/laravelbdsms 我们能提供哪些服务?
定制开发 / 二次开发

基于 xenon/laravelbdsms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8.55k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 152
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 151
  • Watchers: 3
  • Forks: 56
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-28