Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

138 lines (86 sloc) 3.475 kb



This documentation is for version 3.0 of twilio-php.


pear channel-discover
pear install twilio/Services_Twilio

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


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

$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

Generating TwiML

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

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

User Guide

API Documentation

Support and Development

All development occurs over on Github. To checkout the source,

git clone

Report bugs using the Github issue tracker.

If you’ve got questions that aren’t answered by this documentation, ask the #twilio IRC channel

Running the Tests

The unit tests depend on Mockery and PHPUnit. First, 'discover' all the necessary pear channels (which is ridiculous)

pear channel-discover
pear channel-discover
pear channel-discover
pear channel-discover
pear channel-discover
pear install --alldeps deepend/Mockery
pear install phpunit/PHPUnit

After installation, run the tests with :data:`make`

make test

Making the Documentation

Our documentation is written using Sphinx. You'll need to install Sphinx and the Sphinx PHP domain before you can build the docs.

pip install Sphinx sphinxcontrib-phpdomain

Once you have those installed, making the docs is easy.

cd docs
make html
Jump to Line
Something went wrong with that request. Please try again.