io-digital / clickatell
Clickatell通知驱动
1.0.0
2022-12-05 12:47 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.2
- illuminate/notifications: ~5.5 || ~6.0 || ~7.0 || ~8.0 || ~9.0
- illuminate/support: ~5.5 || ~6.0 || ~7.0 || ~8.0 || ~9.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ~1.2
- phpmd/phpmd: ^2.9
- phpunit/phpunit: ~8.3
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-09-05 16:28:39 UTC
README
此包使您能够使用Laravel 5.5+、6.x和7.x轻松发送通过clickatell.com的通知。
内容
安装
您可以通过composer安装此包
composer require io-digital/clickatell
设置clickatell服务
将您的Clickatell用户名、密码和API标识符添加到您的config/services.php
// config/services.php ... 'clickatell' => [ 'api_key' => env('CLICKATELL_API_KEY'), ], ...
使用
号码格式:+27840000000
为了将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 IoDigital\Clickatell\ClickatellMessage; use IoDigital\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!"); } }
Notification::route('clickatell', 'YOUR E164 NUMBER') ->notifyNow(new \App\Notifications\MyNotification($model));
变更日志
有关最近更改的更多信息,请参阅变更日志
测试
$ composer test
安全
如果您发现任何与安全相关的问题,请通过contact@io.co.za发送电子邮件,而不是使用问题跟踪器
贡献
有关详细信息,请参阅贡献
致谢
- etiennemarais
- arcturial
- 对于Clickatell客户端实现,这是我为此包装利用的
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件