PHP
Clone or download
Permalink
Failed to load latest commit information.
src Added support for 5.5 (#21) Nov 22, 2017
tests code review Aug 15, 2016
.editorconfig initial Aug 15, 2016
.gitattributes initial Aug 15, 2016
.gitignore initial Aug 15, 2016
.scrutinizer.yml Add code coverage (#3) Aug 16, 2016
.styleci.yml initial Aug 15, 2016
.travis.yml Add code coverage (#3) Aug 16, 2016
CHANGELOG.md updated Changelog Aug 25, 2016
CONTRIBUTING.md initial Aug 15, 2016
LICENSE.md initial Aug 15, 2016
README.md Update README.md Mar 12, 2017
composer.json Update composer.json to support laravel 5.6 (#23) Mar 27, 2018
phpunit.xml.dist initial Aug 15, 2016

README.md

Plivo notifications channel for Laravel 5.3+

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send SMS notifications using Plivo with Laravel 5.3.

Contents

Installation

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,
],

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 body
  • from() - (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.