Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A PHP library for communicating with the Twilio API and generating TwiML

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 Services
Octocat-spinner-32 docs
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.md
Octocat-spinner-32 package.php
Octocat-spinner-32 package.xml
README.md

Twilio API helper library

Installing

Via PEAR:

pear channel-discover twilio.github.com/pear
pear install twilio/Services_Twilio

If you aren't using PEAR, you can just download the source

Quickstart

Getting started with the Twilio API couldn't be easier. Create a Twilio REST client to get started. For example, the following code makes a call using the Twilio REST API.

Making a Call

require "Services/Twilio.php";

$sid = "ACXXXXXX"; // Your Twilio account sid
$token = "YYYYYY"; // Your Twilio auth token

$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create(
    '9991231234', // From this number
    '8881231234', // Call this number
    'http://foo.com/call.xml'
);

Generating TwiML

To control phone calls, your application need to output TwiML. Use Services_Twilio_Twiml to easily create such responses.

$response = new Services_Twilio_Twiml();
$response->say('Hello');
print $response;
<?xml version="1.0" encoding="utf-8"?>
<Response><Play loop="5">monkey.mp3</Play><Response>

Full Documentation

http://readthedocs.org/docs/twilio-php/en/latest/

Something went wrong with that request. Please try again.