Giter Club home page Giter Club logo

laravel-plivo-sms's Introduction

Plivo notifications channel for Laravel 5.3

This package makes it easy to send SMS notifications using [Plivo][https://plivo.com] with Laravel 5.3.

Update

This package is now part of Laravel Notification Channels - https://github.com/laravel-notification-channels/plivo.

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 [Plivo::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 [email protected] 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.

laravel-plivo-sms's People

Contributors

koomai avatar freekmurze avatar themsaid avatar irazasyed avatar mpociot avatar casperboone avatar

Stargazers

Rohan Deshpande avatar

Watchers

James Cloos avatar  avatar

laravel-plivo-sms's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.