devfaysal / laravel-muthofun-sms
MuthoFun SMS Gateway API 的简单 Laravel 包装器
1.1
2024-06-20 04:22 UTC
Requires
- php: ^7.3|^8.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
README
MuthoFun SMS Gateway API 的简单 Laravel 包装器
安装
composer require devfaysal/laravel-muthofun-sms
可选:发布配置文件
php artisan vendor:publish --provider="Devfaysal\Muthofun\MuthofunServiceProvider"
设置 API 密钥
从 https://clients.muthobarta.com/developers/api 复制 API 密钥并添加到 .env 文件中。
示例:MUTHOFUN_API_KEY="Token 1f2d5f6e9e9e8r5d5s5s6f9f"
升级指南
如果您使用的是旧版 API,请按照以下步骤进行升级
- 如果已发布配置文件,请重新发布配置文件
php artisan vendor:publish --provider="Devfaysal\Muthofun\MuthofunServiceProvider" --force
- 从配置或 .env 文件中删除旧的用户名和密码
- 将新的 API 密钥添加到 .env 文件中
用法
向单个收件人发送短信
use Devfaysal\Muthofun\Facades\Muthofun; Muthofun::send('01717012345' , 'Your Message!!'); //Returns status code. 200 for success
向多个收件人发送短信
use Devfaysal\Muthofun\Facades\Muthofun; $users = [ '01717012345', '01671012345', '01811012345' ] Muthofun::send($users , 'Your Message!!'); //Returns status code. 200 for success
投递报告
use Devfaysal\Muthofun\Facades\Muthofun; Muthofun::deliveryReport(); //Returns array [ [ "shoot_id" => "R200008462443416b5e06" "receiver" => "8801671012345" "sender_id" => "8809601000000" "operator_name" => "Airtel" "sms_type" => "text" "sms_length" => 24 "sms_count" => 1 "sms_body" => "Testing package from app" "sms_rate" => 0.25 "sms_cost" => 0.25 "status" => "Delivered" "created_at" => "2022-03-30T16:42:28.797410+06:00" ], [ "shoot_id" => "R2000084624434169918a" "receiver" => "8801717012345" "sender_id" => "8809601000000" "operator_name" => "GP" "sms_type" => "text" "sms_length" => 24 "sms_count" => 1 "sms_body" => "Testing package from app" "sms_rate" => 0.25 "sms_cost" => 0.25 "status" => "Delivered" "created_at" => "2022-03-30T16:42:28.782344+06:00" ] ]
账户余额
use Devfaysal\Muthofun\Facades\Muthofun; //Get only balance Muthofun::accountBalance(); //Returns balance in BDT 3.5 //Get details balance information Muthofun::accountBalance(true); //Returns array [ "code" => 200 "message" => "User balance received successfully!" "balance" => 3.5 "expiry" => "2022-04-28T11:05:21.671640Z" ]
待办事项
- 发送个性化短信(为不同的收件人发送不同的消息。)
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件 devfaysal@gmail.com 联系我们,而不是使用问题跟踪器。