This is a package for sending SMS for Laravel and PHP built with Plivo. Check it out and have fun!
Download package form plivo . Place it in vendor directory of your project. edit composer.json file or Run following command
composer require lakshmajim/plivo
Run follwoing command from the Terminal:
composer dumpautoload
composer update
Add following lines to app/config/app.php
.
lakshmajim\plivo\PlivoServiceProvider::class,
'Plivo' => lakshmajim\plivo\Facade\Plivo::class,
SENDING SMS
<?php
Use Plivo;
//send sms using sendMessagePlivo() method
Plivo::sendMessagePlivo($auth_id,$auth_token);
//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/");
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.
use Illuminate\Routing\Controller as BaseController; use Plivo; class PlivoController extends BaseController { public function sendSMS() { $src = Plivo::setSourceMobile(" $dest = Plivo::setDestinationMobile(" $txt = Plivo::setMessagePlivo(" $url = Plivo::setCallBackUrl(" $smsObject=Plivo::sendMessagePlivo(' echo "$smsObject"; //diaplay final message response } }
<?php namespace App\Http\Controllers;