coderam / clickatell
Clickatell 通知驱动
1.0
2020-10-20 19:01 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.3
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2024-09-21 03:13:24 UTC
README
此包简化了使用 Laravel 5.5+、6.x 和 7.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!"); } }
可用方法
待办事项
变更日志
请参阅 变更日志 了解最近更改的信息。
测试
$ composer test
安全
如果您发现任何安全相关的问题,请通过电子邮件 hello@etiennemarais.co.za 而不是使用问题跟踪器来报告。
贡献
有关详细信息,请参阅 贡献。
致谢
- etiennemarais
- arcturial
- 关于 Clickatell 客户端实现,这是我用来创建此包装器所依赖的。
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。