Methods

Objects

PHP

SDK Installation Guide

How to install the CALLR PHP SDK with and without PHP Composer

Summary

    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:
    2. {
          "require": {
              "callr/sdk-php": "^0.11"
          }
      }
      

    3. As an alternative, to automatically create the composer.json and install the sdk run composer require callr/sdk-php

    4. In your project source files, be sure to require the file autoload.php
    5. <?php
              require 'vendor/autoload.php';
      
      

    6. 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.
    7. 
          $ composer update
          Loading composer repositories with package information
          Updating dependencies (including require-dev)
          - Installing callr/sdk-php (v0.x)
          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:
    4.     // require source objects
          require '../src/CALLR/Api/Client.php';
          require '../src/CALLR/Api/Request.php';
          require '../src/CALLR/Api/Response.php';
          require '../src/CALLR/Api/Exception/LocalException.php';
          require '../src/CALLR/Api/Exception/RemoteException.php';
          require '../src/CALLR/Api/Authentication/AuthenticationInterface.php';
          require '../src/CALLR/Api/Authentication/LoginPasswordAuth.php';
      
          // get api client object
          $api = new \CALLR\API\Client;
      
          // set authentication credentials
          $api->setAuth(new CALLR\API\Authentication\LoginPasswordAuth($login, $password));
          print_r($api->call('system.get_timestamp',[]));
          ...
      
      

    5. For creating realtime application flows, the libraries needed are the following:
    6. // require source objects
          require 'vendor/autoload.php'; // Composer
          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