Package Data | |
---|---|
Maintainer Username: | daveNcbus |
Maintainer Contact: | davidvarney@gmail.com (David Varney) |
Package Create Date: | 2017-01-24 |
Package Last Update: | 2017-01-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-14 15:12:29 |
Package Statistics | |
---|---|
Total Downloads: | 17 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Plivo Complete is a simple Laravel 5 driver for the Plivo PHP library
Install via composer
"require": {
...
"davidvarney/plivo-complete": "1.0.0",
},
In the config/app.php
file and within the 'providers' => [
array place the following towards the end of the array
'providers' => [
...
DavidVarney\Plivo\PlivoServiceProvider::class,
],
In the same config/app.php
file and within the 'aliases' => [
array place the following towards the end of the array
'aliases' => [
...
'Plivo' => DavidVarney\Plivo\Plivo::class,
],
You don't have to run the dump-autoload
command but I usually do just for good measure.
$ composer dump-autoload
$ composer update
Next we're going to create the necessary config file so that we can insert our Auth ID and Auth Token from our Plivo account
$ php artisan vendor:publish
After publishing the config file make your way to the config
directory and look for the following file: config/plivo.php
You should see that the config file is looking for two environment variables. You have two options.
Place the auth_token and auth_id within the env()
function like so:
return [
'auth_token' => env('PLIVO_AUTH_TOKEN', TOKEN_HERE),
'auth_id' => env('PLIVO_AUTH_ID', ID_HERE)
];
You can simply leave the config file alone and place the 'PLIVO_AUTH_TOKEN'
and 'PLIVO_AUTH_ID'
inside of the .env
file.
...
PLIVO_AUTH_TOKEN=YOUR_AUTH_TOKEN_HERE
PLIVO_AUTH_ID=YOUR_AUTH_ID_HERE
Now you should be able to simply use it within a Controller like so
<?php
namespace App\Http\Controllers\YourController;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Plivo;
class YourController extends Controller
{
public function index()
{
$plivo = new Plivo;
return view('myview.index', array(
'plivo' => $plivo
));
}
}
Then your view would look something like this:
@extends('layouts.frontend.app')
@section('content')
{!! dd($plivo->get_account()) !!}
@endsection
You can use any RestAPI method that is available in the Plivo RestAPI PHP library