chitranu/textlocal-laravel-notification-channel
Composer 安装命令:
composer require chitranu/textlocal-laravel-notification-channel
包简介
Textlocal SMS Notification channel for Laravel
README 文档
README
This package makes it easy to send notifications using Textlocal with Laravel framework.
Contents
Installation
You can install the package via composer:
composer require chitranu/textlocal-laravel-notification-channel
Setting up the Textlocal SMS service
Add your Textlocal API key and sender to your config/services.php:
<?php return [ // ... 'textlocal' => [ 'key' => env('TEXTLOCAL_KEY'), 'sender' => env('TEXTLOCAL_SENDER'), ], ];
Usage
Now you can use the channel in your via() method inside the notification:
<?php use NotificationChannels\Textlocal\TextlocalChannel; use NotificationChannels\Textlocal\TextlocalMessage; use Illuminate\Notifications\Notification; class AccountApproved extends Notification { public function via($notifiable) { return [TextlocalChannel::class]; } public function toSms($notifiable) { // OR explicitly return a TextlocalMessage object passing the message body: return new TextlocalMessage("Your {$notifiable->service} account was approved!"); } }
In order to let your Notification know which phone are you sending to, the channel
will look for the phone, mobile, phone_number or full_phone attribute of the
Notifiable model. If you want to override this behaviour, add the
routeNotificationForTextlocal method to your Notifiable model.
<?php use Illuminate\Notifications\Notifiable; class SomeModel { use Notifiable; public function routeNotificationForTextlocal($notification) { return '+1234567890'; } }
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email hey@swapnil.dev instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-27