twilio / voice-quickstart-server-php

Voice Quickstart Server in PHP
MIT License
8 stars 19 forks source link

Programmable Voice: Quickstart Application Server - PHP

This repository contains the server-side web application required to run the Twilio Programmable Voice iOS SDK Quickstart and Android SDK Quickstart mobile sample apps.

Looking for the Quickstart mobile app?

Download the client-side Quickstart Applications in Swift and iOS here:

Download the client-side Quickstart Application for Android here:

Prerequisites

Setting up the Application

Create a configuration file for your application:

cp config.example.php config.php

Edit config.php with your Twilio credentials.

Next, we'll need to install the Twilio Helper library via Composer.

composer install

If composer install fails ensure that you have added it correctly to your path by following the instructions on Composer.

Now we should be all set! Run the application using the php -S command.

php -S 127.0.0.1:3000

Visit http://localhost:3000 to ensure the server is running.

Up and running

This web application needs to be accessbile on the public internet in order to receive webhook requests from Twilio. Ngrok is a great options for getting this done quickly.

Once you have the application running locally, in a separate terminal window, make your server available to the public internet with the following:

ngrok http 3000

You should see a dynamically generated public Ngrok URL in the command window. Ngrok will now tunnel all HTTP traffic directed at this URL to your local machine at port 3000.

Test the app

Test your app by opening the {YOUR_SERVER_URL}/accessToken.php endpoint in your browser. Use the publicly accessible domain on ngrok. You should see a long string. This is an Access Token. You can examine its contents by pasting it into a JWT tool like jwt.io.

License

MIT