Skip to content
A PHP library for communicating with the Twilio API and generating TwiML
Pull request Compare This branch is 737 commits behind twilio:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

A Brief Introduction

With version 3.0 we've simplified interaction with the Twilio REST API. No more manually creating URLS or parsing XML/JSON. You now interact with resources directly. Follow the Quickstart Guide to get up and running right now. The User Guide shows you how to get the most out of twilio-php.


  • PHP >= 5.2.1
  • The PHP JSON extension


Via PEAR (>= 1.9.3):

pear channel-discover
pear install twilio/Services_Twilio

From Source

Not using PEAR? Not a problem. Download the source which includes all dependencies.


Want to get up running with twilio-php in minutes? Read through the quickstart here. Highly suggested reading.

Full Documentation

Reporting Issues

Report issues using the Github Issue Tracker or email

Sample Code

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

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->play('monkey.mp3', array("loop" => 5));
print $response;
<?xml version="1.0" encoding="utf-8"?>
  <Play loop="5">monkey.mp3</Play>
Something went wrong with that request. Please try again.