godforhire / prowlnotifications
Prowl Notifications 驱动程序,适用于 Laravel 6 及以上版本。
1.0.1
2019-09-14 22:04 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^6.2
- illuminate/notifications: ^6.0
- illuminate/support: ^6.0
This package is auto-updated.
Last update: 2024-09-15 08:49:52 UTC
README
此包使用 Laravel 6 简化通过 Prowl 发送通知。
内容
安装
您可以通过 composer 安装此包。
composer require godforhire/prowlnotifications
设置 Prowl 服务
将您的 Prowl API 令牌添加到 config/services.php
文件中。
// config/services.php 'prowl' => [ 'token' => env('PROWL_API_KEY'), ]
使用方法
现在您可以在通知中的 via()
方法中使用该频道。
use godforhire\ProwlNotifications\ProwlChannel; use godforhire\ProwlNotifications\ProwlMessage; use Illuminate\Notifications\Notification; class BackupHasFailed extends Notification { public function via($notifiable) { return [ProwlChannel::class]; } public function toProwl($notifiable) { return ProwlMessage::create() ->priority(2) ->url('http://your.app'); ->application("Your App") ->event("Backup failed") ->description("Daily backup of Your App has failed: reason, disk S3 is unreachable.") } }
可用的消息方法
priority
可选。如果未提供,默认值为 0。一个范围在 [-2, 2] 的整数值,代表:-2 非常低,-1 中等,0 正常,1 高,2 紧急。紧急优先级消息可能会根据用户设置跳过静音时段。url
[512] 可选。应附加到通知的 URL。启动时将触发重定向,且可在通知列表中查看。application
[256] 您的应用程序名称或生成事件的程序。event
[1024] 事件名称或通知的主题。description
[10000] 事件描述,通常简洁。
更多信息请参阅 Prowl 网站。
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。