Skip to content

Latest commit

 

History

History
103 lines (81 loc) · 3.51 KB

File metadata and controls

103 lines (81 loc) · 3.51 KB

PHP SDK Installation

Table of contents


Requirements

The installation and usage of the php-sdk requires the following:

  • PHP 5.4+
  • php5-curl

With Composer

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=
  1. After downloading and installing composer, make sure you have a composer.json file located in the document root of your project, it should contain as a minimum the following:

    {
      "require": {
        "callr/sdk-php": "^0.9"
      }
    }
  2. As an alternative, to automatically create the composer.json and install the sdk run composer require callr/sdk-php:^0.9

  3. In your project source files, be sure to require the file autoload.php

    <?php
        require 'vendor/autoload.php';
  4. 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

Without Composer

If you wish to use the sdk without the dependency management of Composer it is possible with the following steps

  1. Download the sdk from the CALLR php-sdk github

  2. Unzip the archive and move the src directory into your project structure

  3. 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);
    ...
  4. 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;
    ...

Further help

If you have any further questions or require assistance with these examples, please contact CALLR Support