lucasgiovanny / laravel-notification-smsdev
此包已被放弃且不再维护。未建议替代包。
Laravel 通知包,用于使用 SMSDev 短信服务。
v1.1.1
2021-01-26 17:21 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ~6.0
- illuminate/notifications: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ^5.2
This package is auto-updated.
Last update: 2023-03-24 11:54:35 UTC
README
该项目不再维护
此包使您能够使用 Laravel 通过 SMSDev 发送通知。
内容
安装
此包可以通过 composer 安装
composer require lucasgiovanny/laravel-notification-smsdev
设置 SMSDev 服务
- 将 API 密钥添加到
services.php
配置文件
// config/services.php ... 'smsdev' => [ 'api_key' => env('SMSDEV_API_KEY') ], ...
- 将来自 SMSDev 的 API 密钥添加到您的
.env
文件
使用
- 首先,您需要在
User
模型中添加函数routeNotificationFor
public function routeNotificationFor() { return $this->phone_number; //replace with the phone number field you have in your model }
- 现在,您可以通过将
SmsDevChannel::class
添加到通知类中via()
方法数组的来使用此通道。您需要添加toSmsdev()
方法,该方法应返回一个new SmsDevMessage()
对象。
<?php namespace App\Notifications; use Illuminate\Notifications\Notification; use lucasgiovanny\SmsDev\SmsDevChannel; use lucasgiovanny\SmsDev\SmsDevMessage; class InvoicePaid extends Notification { public function via($notifiable) { return [SmsDevChannel::class]; } public function toSmsdev() { return (new SmsDevMessage('Invoice paid!')); } }
可用消息方法
-
getPayloadValue($key)
: 返回给定键的负载值。 -
content(string $message)
: 设置短信消息文本。 -
to(string $number)
: 手动设置接收者号码(国际格式)。
变更日志
请参阅 CHANGELOG 了解最近更改的信息。
测试
$ composer test
安全
如果您发现任何安全问题,请通过电子邮件 lucasgiovanny@gmail.com 报告,而不是使用问题跟踪器。
贡献
请参阅 CONTRIBUTING 了解详细信息。
致谢
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件。