Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Twilio Best Practices

You're reading from   Twilio Best Practices Learn how to build powerful real-time voice and SMS applications with Twilio

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781782175896
Length 178 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (10) Chapters Close

PHP – a recap


We've already worked with the PHP library in Chapter 2, Exploring the REST API, but it's worth a quick recap so we can see more clearly how it compares with libraries in the other languages we'll be looking at.

To get a hold of the PHP library, we can manually download its source and include it into our project ourselves. However, it's much better to use Composer, which is a dependency management tool for PHP.

First, you'll need to install Composer for your platform. Follow the instructions at https://getcomposer.org/doc/00-intro.md to get up and running.

Once Composer is set up, simply run this in your project directory:

composer require twilio/sdk dev-master

This will create a composer.json file for you to record your and then will add the Twilio library to this file, download the library and all of its dependencies, and generate an autoload.php file.

Now that the library is installed into our project, we can set up the client as follows:

<?php
// Require Composer's autoload...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime