khbd/laravel-sms-bd
Composer 安装命令:
composer require khbd/laravel-sms-bd
包简介
Laravel sms BD is a Laravel Package for Sending out SMS from multiple Gateways
README 文档
README
This is a Laravel library to send SMS and switch between multiple SMS Gateways.
Installation
You can install the package via composer:
composer require khbd/laravel-sms-bd
The package will register itself automatically.
Then publish the package configuration file
php artisan vendor:publish --provider=Khbd\LaravelSmsBD\SMSServiceProvider
or
php artisan vendor:publish --provider=Khbd\LaravelSmsBD\SMSServiceProvider --tag="sms"
For store sms log in db run migration
php artisan migrate
Usage
Check 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');
Adding new Gateway
use command
php artisan make:gateway MyGateway
A 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.
Changing Gateway
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');
Checking SMS balance
SMS::getBalance(); //or SMS::gateway('mygateway')->getBalance();
Delivery Reports
sms()->getDeliveryReports(Request $request); //or sms()->gateway('mygateway')->getDeliveryReports(Request $request);
.env Config
Bangladesh SMS
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 database
Teletalk SMS
If 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 database
Contributing
Suggestions, pull requests , bug reporting and code improvements are all welcome. Feel free.
TODO
Write Tests
Credits
License
The MIT License (MIT). Please see License File for more information.
khbd/laravel-sms-bd 适用场景与选型建议
khbd/laravel-sms-bd 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.74k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2021 年 02 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 khbd/laravel-sms-bd 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 khbd/laravel-sms-bd 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-24