superbalist/simple-sms-panacea-mobile

该软件包已被弃用,不再维护。未建议替代包。

simple-sms Laravel 库的适配器,用于通过 Panacea Mobile API 发送短信

1.0.0 2016-10-10 09:24 UTC

This package is auto-updated.

Last update: 2022-07-13 19:39:05 UTC


README

simple-sms Laravel 库的适配器,用于通过 Panacea Mobile API 发送短信

Author Build Status StyleCI Software License Packagist Version Total Downloads

安装

composer require superbalist/simple-sms-panacea-mobile

该软件包具有默认配置,使用以下环境变量。

PANACEA_MOBILE_USERNAME=null
PANACEA_MOBILE_PASSWORD = null

如果您希望手动配置,您需要首先使用 Artisan 发布 simplesms 软件包配置。

php artisan vendor:publish --provider="SimpleSoftwareIO\SMS\SMSServiceProvider"

然后您需要将以下内容追加到生成的配置文件 app/config/sms.php 中。

// ...
'panacea_mobile' => [
    'username' => env('PANACEA_MOBILE_USERNAME'),
    'password' => env('PANACEA_MOBILE_PASSWORD')
],

在 app.php 中注册服务提供者

'providers' => [
    // ...
    Superbalist\SimpleSMSPanaceaMobile\PanaceaMobileSMSServiceProvider::class,
]

用法

// if 'panacea_mobile' is your default simplesms driver - `SMS_DRIVER`
$sms = app('sms'); /** @var \SimpleSoftwareIO\SMS\SMS $sms */

// send a simple message
$sms->send('This is my message content', [], function (OutgoingMessage $sms) {
    $sms->to('+27000000000');
});

// send a message from a view file
$viewData = [
    'lorem' => 'ipsum',
];
$sms->send('path.to.my.view.file' $viewData, function (OutgoingMessage $sms) {
    $sms->to('+27000000000');
});

// if 'panacea_mobile' is not your default driver
$sms->driver('panacea_mobile')->send('This is my message content', [], function (OutgoingMessage $sms) {
    $sms->to('+27000000000');
});

// see https://www.simplesoftware.io/docs/simple-sms#docs-usage for more usage examples