Plivo SMS notifications driver for Laravel
Installs: 15 187
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 8
Forks: 19
Open Issues: 5
Requires
- php: >=7.2
- illuminate/events: ~6.0 || ~7.0 || ~8.0
- illuminate/notifications: ~6.0 || ~7.0 || ~8.0
- illuminate/support: ~6.0 || ~7.0 || ~8.0
- plivo/plivo-php: ^1.1
Requires (Dev)
- mockery/mockery: ^1.3
- phpunit/phpunit: ^8.5 || ^9.3
README
This package makes it easy to send SMS notifications using Plivo with Laravel 6.x and higher.
Contents
Installation
Install the package via composer:
composer require laravel-notification-channels/plivo
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'), ],
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 number
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.