PHP Voice Calling Quickstart

Build a simple PHP application that answers a call and plays a message to the caller.


You're ready for this Quickstart if you've got the following:

A free trial account
A registered application
A configured FreeClimb Number
Your tools and language installed

Configure Your Application to Process FreeClimb Requests

After you've created an application and assigned a number to it, you're ready to configure your application to process requests from FreeClimb.

Install the FreeClimb PHP SDK:

composer require freeclimb/sdk
composer update freeclimb/sdk

Once you've installed the SDK, you can include the functionality for handling requests from FreeClimb with the following code:

require_once "vendor/autoload.php";
use FreeClimb\Percl\PerclScript;
use FreeClimb\Percl\Say;

header("content-type: text/json");

$response = new PerclScript();

$say = new Say().message(
    "Welcome to the FreeClimb SDK!"


echo $response.toJson();

Run your server:

php -S localhost:8000

Make Your Local Server Publicly Accessible

The fastest way to start testing your FreeClimb application is to temporarily make your local server publicly accessible through a tunneling service. We'll use ngrok to do this. Start by downloading Ngrok. Unzip the file to install, then open your terminal and navigate to the directory where you've unzipped Ngrok. Use the following command to start a HTTP tunnel on port 80.

./ngrok http 80

Once you run Ngrok you should receive a response with a public URL, that looks something like this:

ngrok by @inconshreveable

Tunnel Status                 online
Version                       2.0/2.0
Web Interface       
Forwarding           -> localhost:80
Forwarding           -> localhost:80

Connnections                  ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

The Forwarding URLs point to your local server. Save the URLs and go on to the next step.

Configure Your Application's Endpoints

Now that you've got a public URL you're ready to configure your application's endpoints. We'll be configuring the voiceUrl using your Ngrok URL and the route reference /say_hello.php.

Go to the Apps page in your Dashboard. You should see your registered FreeClimb app.

Your Apps page

Open its App Config, and you'll see its application ID, alias, and some options for URL configuration. Enter your Ngrok URL into the voiceUrl field, and add the route /say_hello.php at the end of the URL.


When you're done the App Config should look something like this:

Example completed app config

Save your updated App Config.

Experience Your App

Once you've updated your App Config you're all ready to run your app! Run the application with the command:

> curl localhost:8000/say_hello.php
[{"Say":{"text":"Hello, world!","language":"en-US"}}]

Once the app is running, dial your configured FreeClimb number. If everything is set up right you should hear the message, "Hello, world!" and then the call will end.

Congratulations! You've just made your first voice calling application!

Next Steps

For a more detailed explanation of the code used, see How to Accept an Incoming Call.

Updated 11 months ago

PHP Voice Calling Quickstart

Build a simple PHP application that answers a call and plays a message to the caller.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.