Skip to content

popas/plivo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

Laravel - plivo

##WHAT IT IS?

  • This package is used to send sms to any mobile number.
  • This uses Plivo! API.
  • It requires AuthId and AuthToken, they can be generated by registrting @at Plivo
    • after registrion click on Dashboard ,there you will be able to see authid and authtoken.
    • sample snapshot: Image of plivo dashboard

##INSTALLATION

Download package form https://github.com/lakshmajim/plivo . Place it in vendor directory of your project. edit composer.json file

 "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/",
            "lakshmajim\\plivo\\": "vendor/lakshmajim/plivo/src"   
        }
    },

Run this command from the Terminal:

    composer dumpautoload
    composer update

##Laravel INTEGRATION

you need to add the service provider. Open app/config/app.php, and add a new item to the providers array.

 lakshmajim\plivo\PlivoServiceProvider::class,

Then, add a Facade for more convenient usage. In app/config/app.php add the following line to the aliases array:

'Plivo'     => lakshmajim\plivo\Facade\Plivo::class,

##SENDING SMS

<?php

Use Plivo;

Plivo::sendMessagePlivo($auth_id,$auth_token);

##MISCELLANEOUS

<?php

  Use Plivo;
  //setting source mobile number
  Plivo::setSourceMobile("918888888888");
  //setting destination mobile number
  Plivo::setDestinationMobile("919999999999");
  //setting text message
  Plivo::setMessagePlivo(" is!");
  //setting call back url
  Plivo::setCallBackUrl("http://localhost/");```

##EXAMPLE CODE FOR Laravel

<?php namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
use Plivo;

class Controller extends BaseController
{
       public function sendSMS()
    {
        $src  = Plivo::setSourceMobile("<SOURCE MOBILE NUMBER>");
        $dest = Plivo::setDestinationMobile("<RECEIVERS MOBILE NUMBER>");
        $txt  = Plivo::setMessagePlivo("<YOUR TEXT MESSAGE>");
        $url  = Plivo::setCallBackUrl("<YOUR_RETURN_BACK_URL>");
        $smsObject=Plivo::sendMessagePlivo('<YOUR_AUTH_ID>','<YOUR_AUTH_TOKEN>');
        echo "$smsObject";         //diaplay final message response
    }
}

##LICENSE

The MIT License (MIT)

Copyright (c) 2015 Plivo Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Image ofend of file

About

This package enables to send message or OTP to any mobile.This package uses external plivo api.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%