frdteknikelektro / smsgateway-me
SMSGatewayMe 通知通道用于 Laravel
v1.0.1
2016-10-12 07:25 UTC
Requires
- php: >=5.6.4
- guzzlehttp/guzzle: ^6.2
- illuminate/notifications: ^5.3
- illuminate/queue: ^5.3
- illuminate/support: ^5.1|^5.2|^5.3
- nesbot/carbon: ^1.21
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2024-09-08 09:23:33 UTC
README
以下是关于 Laravel 5.3 通知系统的最新文档
https://laravel.net.cn/docs/master/notifications
SMSGatewayMe 通知通道用于 Laravel
此包使您能够通过 Laravel 5.3 使用 SMSGatewayMe 发送通知变得简单。
内容
安装
您可以通过 composer 安装此包
composer require frdteknikelektro/smsgateway-me
您必须安装服务提供者
// config/app.php 'providers' => [ ... NotificationChannels\SMSGatewayMe\SMSGatewayMeServiceProvider::class, ],
设置 SMSGatewayMe 服务
在 SMSGatewayMe 上注册。设置所有需要的内容,然后将以下内容添加到您的配置文件中
// config/services.php ... 'smsgateway-me' => [ 'email' => env('SMSGATEWAYME_EMAIL', 'email@example.com'), 'password' => env('SMSGATEWAYME_PASSWORD', 'password'), 'device_id' => env('SMSGATEWAYME_DEVICE_ID', '00000') ], ...
使用方法
现在您可以在通知类中的 via()
方法中使用此通道。
use NotificationChannels\SMSGatewayMe\SMSGatewayMeChannel; use NotificationChannels\SMSGatewayMe\SMSGatewayMeMessage; use Illuminate\Notifications\Notification; class InvoicePaid extends Notification { public function via($notifiable) { return [SMSGatewayMeChannel::class]; } public function toSmsGatewayMe($notifiable) { return (new SMSGatewayMeMessage)->text('Your invoice has been paid'); } }
消息路由
您应该在可通知模型中添加 routeNotificationForSmsGatewayMe()
方法
... /** * Route notifications for the SMSGatewayMe channel. * * @return int */ public function routeNotificationForSmsGatewayMe() { return $this->phone_number; } ...
可用方法
text($text)
: (string) 短信文本。
变更日志
请参阅 CHANGELOG 了解最近更改的信息。
测试
在运行测试之前,请配置 routeNotificationForSmsGatewayMe()
和 sendDataProvider()
在 test/Test.php
$ composer test
此测试将发送“Hello World”短信。
安全性
如果您发现任何安全相关的问题,请通过电子邮件发送到 frdteknikelektro@gmail.com,而不是使用问题跟踪器。
贡献
有关详细信息,请参阅 CONTRIBUTING
致谢
许可证
MIT 许可证(MIT)。请参阅 许可证文件 了解更多信息。