klobes / laravel-routee-channel
routee.net 的通知通道
dev-master
2024-08-23 23:22 UTC
Requires
- php: >=7.1.0
Requires (Dev)
- guzzlehttp/guzzle: ^6.3 || ^7.0
- mockery/mockery: ^0.9.5
- phpunit/phpunit: >=7.0 < 10
This package is auto-updated.
Last update: 2024-09-23 23:26:50 UTC
README
此包使您能够通过 Laravel 10.0+ 使用 routee.net 发送短信通知变得容易。
警告!
目前仅实现了 Routee SMS,如果您想使用更多通道,请随时在 RouteeApi 中自行编写,或指向我们可以切换的 API 包装器。
内容
安装
使用 Composer 安装此包
composer require klobes/laravel-routee-channel:dev-master
### Setting up the Routee service
Add your Routee application id, application secret and sender id (from) to your `config/services.php`:
```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)。请参阅 许可文件 了解更多信息。