Giter VIP home page Giter VIP logo

plivo-php-sreyanth's Introduction

Plivo PHP Helper SDK

Note: Bleeding edge: Use with caution

Description

Plivo PHP helper library to access PlivoCloud API and generate Plivo XML

Installation

Download and install composer, a dependency manager for PHP.

Run the command composer require plivo/plivo-php in your project directory to update your composer.json file and download the plivo-php library.

OR

You can clone this repository and then run the command composer install to generate autoload files. Then you can require 'vendor/autoload.php' in your php source code to use the Plivo library

Authentication:

To use the PHP SDK with a single client, create an api object with $api = new PlivoApi(), and all API calls will use this global client by default. We recommend that you store your credentials in the PLIVO_AUTH_ID and the PLIVO_AUTH_TOKEN environment variables, so as to avoid the possibility of accidentally committing them to source control. If you do this, you can initialise the client with no arguments and it will automatically fetch them from the environment variables:

$api = new PlivoApi();

Alternatively, you can provide these to PlivoApi()'s constructor yourself:

$api = new PlivoApi("YOU_AUTH_ID", "YOUR_AUTH_TOKEN");

If you are making several requests to Plivo's API, please re-use the same client instance for maximum efficiency.

The Basics

To send a message:

$api = new PlivoApi();
$api->message->create('14153336666', ['14156667777', '14156668888'], 'Test Message');

To make a call

$api = new PlivoApi();
$api->call->create('14153336666', ['14156667777', '14156668888'], 'http://s3.amazonaws.com/static.plivo.com/answer.xml');

To list all objects of any resource, simply use the request object itself as an iterable:

$api = new PlivoApi();
$messages = $api->message->list;
foreach ($message as $messages) {
    echo $message->id;
}

To generate PlivoXML:

$response = new Response();
$response->addSpeak('Hello World, from Plivo!');
echo($response->toXML());

plivo-php-sreyanth's People

Contributors

sreyantha-plivo avatar

Watchers

 avatar

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.