Skip to main content

Telnyx Development Environment Setup

PHP

Make sure that you have at least PHP version 5.3 installed on your computer, as this is the minimum version of PHP that the SDK requires; we recommended you to always use the latest version of PHP. If PHP isn’t installed, follow the official installation instructions for your operating system to install it. You can check this by running the following:

php --version

Note: After pasting the above content, Kindly check and remove any new line added

Your terminal should reply with something like this:

PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

Note: After pasting the above content, Kindly check and remove any new line added

You’ll also need to have composer installed. Composer is PHP's package manager. While it's not a part of the PHP installation itself, it’s a de-facto standard that virtually every modern PHP library uses. If composer isn’t installed, follow the official composer installation instructions for your operating system to install it. You can check this by running:

composer --version

Note: After pasting the above content, Kindly check and remove any new line added

SDKs and other libraries are always installed for each project as a dependency and stored in a project-specific directory called vendor that Composer manages.

There are two ways to add a package with Composer:

Using the require command

Create a new project directory or open an existing project directory in your terminal. Then, type the following command:

composer require telnyx/telnyx-php

Note: After pasting the above content, Kindly check and remove any new line added

This command installs the latest version of the SDK and automatically creates or updates the files composer.json and composer.lock.

Using composer.json

Create a new project directory or open an existing project directory. In this directory, create a file called composer.json; if you already have this file, you can add the SDK to it; if you only have the SDK in it, the file should look like this:

{
"require": {
"telnyx/telnyx-php": "^0.0.1"
}
}

Note: After pasting the above content, Kindly check and remove any new line added

Keep in mind that you have to specify the version of the SDK in the file. You can see the available SDK versions on Packagist and learn more about different ways to specify versions, for example with ranges, in the Composer documentation .

After saving the file, open a terminal in the directory into which you've stored it and type this command:

composer install

Note: After pasting the above content, Kindly check and remove any new line added

Check out the source on GitHub .

On this page