Package Data | |
---|---|
Maintainer Username: | laravel-notification-channels |
Maintainer Contact: | sid@koomai.net (Sid K) |
Package Create Date: | 2016-08-15 |
Package Last Update: | 2022-09-08 |
Home Page: | https://laravel-notification-channels.com |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:26:38 |
Package Statistics | |
---|---|
Total Downloads: | 15,229 |
Monthly Downloads: | 65 |
Daily Downloads: | 0 |
Total Stars: | 8 |
Total Watchers: | 8 |
Total Forks: | 19 |
Total Open Issues: | 5 |
This package makes it easy to send SMS notifications using Plivo with Laravel 5.3.
You can install this package via composer:
composer require laravel-notification-channels/plivo
Add the service provider to config/app.php
:
// config/app.php
'providers' => [
...
NotificationChannels\Plivo\PlivoServiceProvider::class,
],
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'),
],
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);
}
content()
- (string), SMS notification bodyfrom()
- (integer) Override default from numberPlease see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email sid@koomai.net instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.