laravel-notification-channels / clickatell
Clickatell 通知驱动
0.1.5
2021-09-20 12:27 UTC
Requires
- php: >=7.1
- arcturial/clickatell: ~2.1
- illuminate/notifications: ~5.5 || ~6.0 || ~7.0 || ~8.0
- illuminate/support: ~5.5 || ~6.0 || ~7.0 || ~8.0
Requires (Dev)
- mockery/mockery: ~1.2
- phpunit/phpunit: ~8.3
This package is auto-updated.
Last update: 2024-09-20 19:50:35 UTC
README
此包简化了使用 Laravel 5.5+、6.x、7.x 和 8.x 通过 clickatell.com 发送通知的过程。
内容
安装
您可以通过 composer 安装此包
composer require laravel-notification-channels/clickatell
设置 clickatell 服务
将您的 Clickatell 用户名、密码和 API 标识符添加到您的 config/services.php
// config/services.php ... 'clickatell' => [ 'user' => env('CLICKATELL_USER'), 'pass' => env('CLICKATELL_PASS'), 'api_id' => env('CLICKATELL_API_ID'), ], ...
用法
为了将 Clickatell 通知路由到正确的电话号码,在您的可通知实体上定义一个 routeNotificationForClickatell
方法
class User extends Authenticatable { use Notifiable; /** * Route notifications for the Nexmo channel. * * @param \Illuminate\Notifications\Notification $notification * @return string */ public function routeNotificationForClickatell($notification) { return $this->phone_number; } }
您可以在通知的 via()
方法中使用此通道
use Illuminate\Notifications\Notification; use NotificationChannels\Clickatell\ClickatellMessage; use NotificationChannels\Clickatell\ClickatellChannel; class AccountApproved extends Notification { public function via($notifiable) { return [ClickatellChannel::class]; } public function toClickatell($notifiable) { return (new ClickatellMessage()) ->content("Your {$notifiable->service} account was approved!"); } }
可用方法
待办事项
变更日志
请参阅 CHANGELOG 获取有关最近更改的更多信息。
测试
$ composer test
安全性
如果您发现任何安全问题,请通过电子邮件发送至 hello@etiennemarais.co.za,而不是使用问题跟踪器。
贡献
有关详细信息,请参阅 CONTRIBUTING。
鸣谢
- etiennemarais
- arcturial
- 对于 Clickatell 客户端实现,我是利用这个包装器的。
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。