anheric / laravel-routee-channel
routee.net 通知通道
1.0.0
2020-07-27 12:43 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.3
- illuminate/notifications: ^7.0
- illuminate/support: ^7.0
- nyholm/psr7: ^1.2
- symfony/psr-http-message-bridge: ^1.2
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.0
This package is auto-updated.
Last update: 2024-09-27 21:42:20 UTC
README
本包使得在 Laravel 5.3+ 中使用 routee.net 发送 SMS 通知变得简单。
警告!
目前只实现了 Routee SMS,如果您需要更多通道,请随时在 RouteeApi 中自行编写,或者指向一个我们可以切换的 API 包装器。
内容
安装
使用 Composer 安装此包
composer require laravel-notification-channels/routee
服务提供者会自动加载。或者您也可以手动操作
// config/app.php 'providers' => [ ... NotificationChannels\Routee\RouteeServiceProvider::class, ],
设置 Routee 服务
将您的 Routee 应用程序 ID、应用程序密钥和发送者 ID (from) 添加到您的 config/services.php
// config/services.php 'routee' => [ 'app_id' => env('ROUTEE_APP_ID'), 'secret' => env('ROUTEE_SECRET'), 'from' => env('ROUTEE_SENDER_ID'), ],
用法
您可以在通知内部的 via()
方法中使用此通道
use Illuminate\Notifications\Notification; use NotificationChannels\Routee\RouteeMessage; use NotificationChannels\Routee\RouteeChannel; class AccountApproved extends Notification { public function via($notifiable) { return [RouteeChannel::class]; } public function toRoutee($notifiable) { return (new RouteeMessage) ->content("Your message here"); } }
在您的可通知模型中,请确保包含一个 routeNotificationForRoutee()
方法,该方法返回一个电话号码或电话号码数组。
public function routeNotificationForRoutee() { return $this->phone; }
可用方法
content()
:设置通知消息的内容。
sendAt()
:设置调度通知消息的时间。
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
测试
$ composer test
安全
如果您发现任何安全相关的问题,请通过电子邮件 leo.stratigakis@gmail.com 联系,而不是使用问题跟踪器。
贡献
请参阅 CONTRIBUTING 了解详细信息。
致谢
许可
MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。