bhavinjr / laravel-alots
Laravel SMS APIs for alots
1.3
2021-04-15 04:49 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^7.0.1
- illuminate/database: ^5.4 || ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^5.4 || ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-15 12:15:53 UTC
README
为Laravel 5.*提供简单的alots短信网关实现。
更多信息请访问:https://www.alots.in/
安装
首先,您需要通过Composer安装此包
$ composer require bhavinjr/laravel-alots
如果您不使用Laravel 5.5.*,请更新config/app.php
文件,添加服务提供者的条目。
'providers' => [ // ... Bhavinjr\Alots\Providers\AlotsServiceProvider::class, ]; 'aliases' => [ //... "Alots": "Bhavinjr\Alots\Facades\Alots", ];
在命令行中粘贴以下命令
php artisan config:cache
再次在命令行中,发布默认配置文件
php artisan vendor:publish --provider="Bhavinjr\Alots\Providers\AlotsServiceProvider"
在命令行中粘贴以下命令
php artisan migrate
配置
配置设计得尽可能灵活。全局配置可以在config/alots.php
文件中设置。
return [
'table_names' => [
'messages' => 'alots_messages',
],
];
更新config/alots.php
文件后。
php artisan config:cache
用法
该包为您提供以下方法使用
发送短信非常简单
您需要分别指定mobile_number和sms_text,所有参数都是必需的
Alots::simpleSms()
Alots::simpleSms('9876543210', 'test sms');
Alots::unicodeSms()
发送unicode短信
Alots::unicodeSms('9876543210', 'test sms');
Alots::scheduleSms()
您可以安排短信
Alots::scheduleSms('9876543210', 'test sms', '01012020-1010AM');
Alots::groupSms()
使用组发送短信
您需要分别指定group_id和sms_text,所有参数都是必需的
Alots::groupSms('123', 'test sms');
Alots::getDeliveryReport()
检查短信投递状态。
您需要指定message_id
Alots::getDeliveryReport('123');
Alots::checkCredit()
检查可用的短信/信用额度。
Alots::checkCredit();