kvalitetskontroll / laravel-notification-channel-teletopia-sms
TeletopiaSMS 通知通道 For Laravel
v1.0.0
2021-04-28 21:54 UTC
Requires
- php: >=7.4
- illuminate/notifications: ~6.0 || ~7.0 || ~8.0
- illuminate/support: ~6.0 || ~7.0 || ~8.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-29 06:08:37 UTC
README
此包使您能够通过 Laravel 5.5+、6.x 和 7.x 使用 TeletopiaSMS 发送通知
内容
安装
-
通过 composer 安装
-
将配置添加到您的
services.php
配置文件
'teletopiasms' => [
'user' => env('SERVICES_TELETOPIASMS_USER'),
'password' => env('SERVICES_TELETOPIASMS_PASSWORD'),
'url' => '', // api url
'sender' => '', // sender name
'whitelist' => array_filter(array_map('trim', explode(',', env('SERVICES_TELETOPIASMS_WHITELIST', '')))),
],
- 将凭证添加到
.env
文件
SERVICES_TELETOPIASMS_USER='' // username
SERVICES_TELETOPIASMS_PASSWORD='' // password
SERVICES_TELETOPIASMS_WHITELIST='' // comma separated list of phones which could get sms on local/beta
使用
您可以在通知内的 via()
方法中使用该通道
use Illuminate\Notifications\Notification;
use Kvalitetskontroll\TeletopiaSMS\TeletopiaSmsMessage;
use Kvalitetskontroll\TeletopiaSMS\TeletopiaSmsChannel;
class WelcomeNotification extends Notification
{
public function via($notifiable)
{
return [TeletopiaSmsChannel::class];
}
public function toTeletopiasms($notifiable)
{
return (new TeletopiaSmsMessage)
->message("Welcome to our system");
}
}
在您的可通知模型中,确保包含一个 routeNotificationForTeletopiasms()
方法,该方法返回带有国家代码的电话号码。否则,您需要手动指定电话号码。
public function routeNotificationForTeletopiasms()
{
return $this->phone; // 4712345678
}
可用的消息方法
必需
string message()
:设置通知消息的内容。
可选
array|string recipients()
:设置短信的接收者号码。
* 电话号码应为一个没有前置 '+' 的数字,仅包含国家代码和包括区号的用户号码。
string sender()
:设置发送者的姓名或电话号码。
string salutation()
:设置消息的称呼。
string greeting()
:设置消息的问候语。
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
安全
如果您发现任何与安全相关的问题,请通过电子邮件 it@kvalitetskontroll.no 而不是使用问题跟踪器。
贡献
请参阅 CONTRIBUTING 了解详细信息。
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。