mateusjatenee/laravel-notifications-plivo
Composer 安装命令:
composer require mateusjatenee/laravel-notifications-plivo
包简介
Plivo SMS notifications driver for Laravel
README 文档
README
This is a fork of laravel-notification-channels/plivo with added support to 5.6
This package makes it easy to send SMS notifications using Plivo with Laravel 5.6.
Contents
Installation
You can install this package via composer:
composer require mateusjatenee/laravel-notifications-plivo
Add the service provider to config/app.php:
// config/app.php 'providers' => [ ... Mateusjatenee\Plivo\PlivoServiceProvider::class, ],
Setting up your Plivo service
Log in to your Plivo dashboard and grab your Auth Id, Auth Token and the phone number you're sending from. Add them to config/services.php.
// config/services.php ... 'plivo' => [ 'auth_id' => env('PLIVO_AUTH_ID'), 'auth_token' => env('PLIVO_AUTH_TOKEN'), // Country code, area code and number without symbols or spaces 'from_number' => env('PLIVO_FROM_NUMBER'), // The url Plivo will request to notify about changing sms statuses 'webhook' => '' ],
Usage
Follow Laravel's documentation to add the channel your Notification class:
use Illuminate\Notifications\Notification; use NotificationChannels\Plivo\PlivoChannel; use NotificationChannels\Plivo\PlivoMessage; public function via($notifiable) { return [PlivoChannel::class]; } public function toPlivo($notifiable) { return (new PlivoMessage) ->content('This is a test SMS via Plivo using Laravel Notifications!'); }
Add a routeNotificationForPlivo method to your Notifiable model to return the phone number:
public function routeNotificationForPlivo() { // Country code, area code and number without symbols or spaces return preg_replace('/\D+/', '', $this->phone_number); }
Available methods
content()- (string) SMS notification bodyfrom()- (integer) Override default from numberwebhook()- (string) Override the webhook in the config file
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email sid@koomai.net 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.
统计信息
- 总下载量: 793
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-21