kgoofori/widepay-sms-notification
此包使用 Widepaycash SMS API 以 Laravel 方式轻松发送短信通知
v1.0.3
2021-07-29 11:42 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^6.0 || ^7.0
- illuminate/notifications: ^5.8 || ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^5.8 || ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-22 11:51:27 UTC
README
此包使用 Widepaycash SMS API 以 Laravel 方式轻松发送短信通知
内容
安装
使用 Composer 安装此包
composer require kgoofori/widepay-sms-notification
设置 FCM 服务
您需要在此处为您应用程序注册 Widepaycash API ID 和密钥:https://widepaycash.com/
注册并生成您的 API ID 和密钥后,将 API ID 和密钥添加到您的 config/broadcasting.php
配置中
'connections' => [ .... 'widepay_sms' => [ 'id' => env('WIDEPAY_ID', ''), 'key' => env('WIDEPAY_KEY', ''), ] ... ]
用法
现在,您可以通过创建 WidepaySmsMessage
来通过 Widepay API 发送短信通知
... use NotificationChannels\WidepaySms\WidepaySmsChannel; use NotificationChannels\WidepaySms\WidepaySmsMessage; class UserActivated extends Notification { public function via($notifiable) { return [WidepaySmsChannel::class]; } public function toWidepaySms($notifiable) { return (new WidepaySmsMessage) ->sender('WidepaySms') ->message('Testing message') ->recipient('23324XXXXXXX'); //optional if routeNotificationForWidepaySms() is set on notifiable model } }
您可能需要在您的可通知模型中设置一个 routeNotificationForWidepaySms()
方法。例如
class User extends Authenticatable { use Notifiable; .... /** * Specifies the user's phone * * @return string */ public function routeNotificationForWidepaySms() { return $this->phone; } }
一旦设置好,您就可以简单地通过以下方式向用户发送通知
$user->notify(new AccountActivated);
更改日志
有关最近更改的更多信息,请参阅 CHANGELOG
测试
$ composer test
安全
如果您发现任何安全问题,请通过电子邮件 kgoofori@gmail.com 联系我们,而不是使用问题跟踪器。
致谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件