一个连接到 SMS.to REST API 的 Laravel 扩展包

1.1.0 2019-08-31 16:54 UTC

This package is auto-updated.

Last update: 2024-09-29 05:22:02 UTC


README

Latest Stable Version Build Status License Total Downloads

SMS.to 库用于 Laravel 5.8

Laravel 扩展包,用于与 SMS.to REST API 集成。访问 https://sms.to/ 创建账户并获取 API 凭证。

安装

使用 composer 安装此包

composer require nickmel/laravel-smsto

config/app.php 文件中的 providers 数组中添加提供者

'Nickmel/SMSTo/SMSToServiceProvider',

并在 config/app.php 文件中的 aliases 数组中添加外观

'SMSTo' => 'Nickmel/SMSTo/SMSToFacade',

复制 API 的配置文件

php artisan vendor:publish --tag="laravel-sms-to" 

使用方法

要配置 API,可以设置 .env 文件中的变量或直接编辑发布的 config/laravel-sms-to.php 文件。

获取账户余额
SMSTo::getBalance();
发送单个短信
$messages = [
    [
        'to' => '+357xxxxxxxx',
        'message' => 'An SMS message'
    ]
];

$senderId = 'SENDERID';

SMSTo::sendSingle($messages, $senderId);
发送多个短信
$recipients = ['+357xxxxxxxx', '+357yyyyyyyy'];

$message = 'An SMS message';

$senderId = 'SENDERID';

SMSTo::sendMultiple($message, $recipients, $senderId);
使用通知渠道
Notifications in Laravel can be send to custom channels.