The installation and usage of the php-sdk requires the following:
- PHP 5.4+
- php5-curl
Composer (https://getcomposer.org/download/) is recommended for use with the sdk and for managing your project dependencies.
The download page contains instructions and necessary files for installation on Windows and other platforms.
- if not being installed as root/super user, make sure to use the switch --install-dir=
-
After downloading and installing composer, make sure you have a
composer.jsonfile located in the document root of your project, it should contain as a minimum the following:{ "require": { "callr/sdk-php": "^0.9" } } -
As an alternative, to automatically create the composer.json and install the sdk run
composer require callr/sdk-php:^0.9 -
In your project source files, be sure to require the file
autoload.php<?php require 'vendor/autoload.php';
-
Run
composer update, which will download the sdk either via git ( if found in the environment ), or a zip and install it into the vendor directory.$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) - Installing callr/sdk-php (v0.9.1) Loading from cache Writing lock file Generating autoload files
If you wish to use the sdk without the dependency management of Composer it is possible with the following steps
-
Download the sdk from the CALLR php-sdk github
-
Unzip the archive and move the
srcdirectory into your project structure -
Require each object source file being used, typically for making all api calls it will be the following:
// require source objects require '../src/CALLR/Api/Client.php'; require '../src/CALLR/Api/Request.php'; require '../src/CALLR/Api/Response.php'; // get api client object $api = new \CALLR\API\Client; // set authentication credentials $api->setAuthCredentials($login, $password); ...
-
For creating realtime application flows, the libraries needed are the following:
// require source objects require '../src/CALLR/Realtime/Server.php'; require '../src/CALLR/Realtime/Request.php'; require '../src/CALLR/Realtime/Response.php'; require '../src/CALLR/Realtime/CallFlow.php'; require '../src/CALLR/Realtime/Command.php'; require '../src/CALLR/Realtime/Command/Params.php'; require '../src/CALLR/Realtime/Command/ConferenceParams.php'; // get callflow object $flow = new CallFlow; ...
- You will find API documentation and snippets here at http://thecallr.com/docs/
- Or in our github repository https://github.com/THECALLR/
- Php sdk github here (https://github.com/THECALLR/sdk-php)
- Php examples here (https://github.com/THECALLR/examples-php)
If you have any further questions or require assistance with these examples, please contact CALLR Support
- support@callr.com
- FR: +33 (0)1 84 14 00 30