laravel-notification-channels / vwo-engage
VWO Engage 通知驱动程序
v1.2.0
2020-09-08 11:01 UTC
Requires
- php: ^7.2
- guzzlehttp/guzzle: ^6.2|^7.0
- illuminate/notifications: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^4.0|^5.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-09-08 20:20:38 UTC
README
此包使您能够通过 Laravel 使用 VWO Engage 发送通知变得简单。
内容
安装
您可以通过 composer 安装此包
composer require laravel-notification-channels/vwo-engage
设置 VWO Engage 服务
将您的 VWO Engage API 令牌添加到 config/services.php
// config/services.php 'vwo-engage' => [ 'token' => env('VWO_ENGAGE_API_TOKEN'), ]
使用
现在您可以在通知内的 via()
方法中使用该通道
use Illuminate\Notifications\Notification; use NotificationChannels\Engage\EngageChannel; use NotificationChannels\Engage\EngageMessage; class AccountApproved extends Notification { public function via($notifiable) { return [EngageChannel::class]; } public function toEngage($notifiable) { return EngageMessage::create() ->subject('Your account was approved!') ->body('Click here to see details.') ->icon('https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Laravel.svg/231px-Laravel.svg.png') ->url('https://vwo.com/engage'); } }
为了使您的通知知道您针对的是哪些 VWO Engage 订阅者,请将 routeNotificationForEngage
方法添加到您的可通知模型中。
public function routeNotificationForEngage() { return 'VWO_ENAGE_SUBSCRIBER_ID'; }
您可以返回一个单个订阅者 ID,或者如果您想通知多个订阅者 ID,则返回包含所有 ID 的数组。
要确定订阅者 ID,请阅读此 常见问题解答。
可用消息方法
subject('')
:接受字符串标题值。body('')
:接受字符串通知正文值。icon('')
:接受图标 URL。url('')
:接受通知点击事件的 URL。
有关更多信息,请参阅 此处。
变更日志
有关最近更改的更多信息,请参阅 变更日志。
测试
$ php vendor/bin/phpunit
安全
如果您发现任何与安全相关的问题,请通过电子邮件 bellini.davide@gmail.com 而不是使用问题跟踪器。
贡献
有关详细信息,请参阅 贡献指南。
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。