LaravelPackages.net
Acme Inc.
Toggle sidebar
codemonkey76/plivo-notification-channel

Plivo SMS notifications driver for Laravel

45
0
1.0.6
About codemonkey76/plivo-notification-channel

codemonkey76/plivo-notification-channel is a Laravel package for plivo sms notifications driver for laravel. It currently has 0 GitHub stars and 45 downloads on Packagist (latest version 1.0.6). Install it with composer require codemonkey76/plivo-notification-channel. Discover more Laravel packages by codemonkey76 or browse all Laravel packages to compare alternatives.

Last updated

Plivo notifications channel for Laravel

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

This package is a copy of laravel-notification-channel/plivo as that package is currently broken for Laravel 8 and current version of plivo/plivo-php

Contents

Installation

Install the package via composer:

composer require codemonkey76/plivo-notification-channel

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 Codemonkey76\Plivo\PlivoChannel;
use Codemonkey76\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

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments