From 71d28797b18acd0a3441100a7f8c2d4e20976d60 Mon Sep 17 00:00:00 2001 From: Dion MITCHELL Date: Wed, 16 Nov 2016 14:38:05 +0100 Subject: [PATCH] fix(docs): documentation cleanup, correction of callr site url, composer example updated to use tagged sdk version --- README.html | 333 ------------------ README.md | 29 +- campaign-sendr/README.md | 8 +- campaign-sendr/scripts/composer.json | 2 +- campaign-sendr/scripts/upload.addressbook.php | 4 +- campaign-sendr/scripts/upload.media.php | 2 +- click2call-web/README.html | 183 ---------- click2call-web/README.md | 24 +- click2call-web/composer.json | 2 +- click2call-web/src/index.php | 152 -------- 10 files changed, 34 insertions(+), 705 deletions(-) delete mode 100644 README.html delete mode 100644 click2call-web/README.html diff --git a/README.html b/README.html deleted file mode 100644 index 0876558..0000000 --- a/README.html +++ /dev/null @@ -1,333 +0,0 @@ -README -
- -

-PHP Examples

- -

-Table of contents

- - - -
- -

-General information

- -

This repo contains a collection of projects and scripts both stand alone and dockerized that make use of the CALLR PHP SDK

- -
- -

-Installation

- -

-Requirements

- -

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

- - - -

-Docker

- -

The Docker and docker-compose projects require Docker to be installed: -Docker is available for download on their website https://www.docker.com/

- -

On Windows make sure you install Docker toolbox, -and use the Kitematic application to manage your containers and view their logs and output (installed by default)

- -

-docker-compose

- -

On Windows and Mac the docker-compose utility is installed automatically with docker-toolbox
-For other users, follow the instructions on the official Docker website here

- -
- -

-With php-composer

- -

php-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.

- - - -
    -
  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": "dev-master"
    -  }
    -}
    -
  2. -
  3. As an alternative, to automatically create the composer.json and install the sdk run composer require callr/sdk-php:dev-master

  4. -
  5. -

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

    - -
    <?php
    -    require 'vendor/autoload.php';
    -
  6. -
  7. -

    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 (dev-master 09a2e40)
    -Loading from cache
    -
    -Writing lock file
    -Generating autoload files
    - -
    -
  8. -
- -

-Without php-composer

- -

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

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

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

  4. -
  5. -

    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);
    -...
    -
  6. -
  7. -

    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;
    -...
    -
    -
  8. -
- -
- -

-Viewing output

- -

-Windows / Mac

- -

When docker is installed using the docker-toolbox, an application called Kitematic -is installed alongside, to give a graphical interface for managing your docker images and containers.
-If you want to see the output of a docker-compose command, you must select the correct container listed on the left side of the interface.

- -

-Linux

- -

docker-compose can be run in interactive mode under linux, so you should see the output from containers directly, run docker-compose commands with --rm -for container cleanup after the script has terminated.

- -
- -

-Examples

- -

-Things to note

- - - -

-Click to Call web

- - - -

-Create scheduled IVR campaign

- - - -

-Send SMS

- - - -
$ php sms.php send +33123456789 'Hello from CALLR!'
-Starting script sms.php
-To: +33123456789
-Message: 'Hello from CALLR!'
-Returned result from sms.send: H45HC0D3
-
-$ php sms.php status H45HC0D3
-stdClass Object
-(
-    [type] => OUT
-    [hash] => H45HC0D3
-    [from] =>
-    [to] => +33123456789    
-    [text] => hello from bob, how are you?
-    ...
-    [date_received] => 2016-01-01 06:06:06
-)
-
- -
- -

-Cleanup

- -

-Container cleanup

- -

On windows, for each run of docker-compose a container will be created, dont forget to remove any unwanted containers using docker rm -or the Kitematic tool.
-On Linux docker-compose run script.. can be executed with --rm for after execution cleanup

- -

-Kitematic

- -

If you would like to delete a container, hover your mouse over the container name and click the round X button. -If you would like to delete a docker image ( to rebuild if you have made a change to a script )

- -
    -
  1. Make sure all containers linked to this image have been removed.
  2. -
  3. Select 'My Images' from the Top Right of the interface
  4. -
  5. Click on the '...' button and choose 'Remove Tag'
  6. -
  7. If no containers are using the image, it will be successfully removed.
  8. -
- -

-Advanced

- -

Advanced users can remove containers and images with docker rm/rmi

- -
- -

-Further help

- - - -

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

- - - -
- - - -
-

-
- diff --git a/README.md b/README.md index 7ac7b4f..59ddbe7 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ * [Requirements](#requirements) * [Docker](#docker) * [docker-compose](#docker-compose) - * [With php-composer](#with-php-composer) - * [Without php-composer](#with-php-composer) + * [With Composer](#with-composer) + * [Without Composer](#with-composer) * [Examples](#examples) * [Click to Call Web](#click-to-call-web) * [Create scheduled IVR campaign](#create-scheduled-ivr-campaign) @@ -42,8 +42,8 @@ For other users, follow the instructions on the official [Docker website here](h - - - -## With php-composer -php-composer ([https://getcomposer.org/download/](https://getcomposer.org/download/)) is recommended for use with the sdk and for managing your project dependencies. +## With Composer +Composer ([https://getcomposer.org/download/](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=** @@ -52,25 +52,24 @@ The download page contains instructions and necessary files for installation on ```json { "require": { - "callr/sdk-php": "dev-master" + "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:dev-master` +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 call('jobs.get', [$importJobId]); diff --git a/campaign-sendr/scripts/upload.media.php b/campaign-sendr/scripts/upload.media.php index c7a221e..aeb3a30 100644 --- a/campaign-sendr/scripts/upload.media.php +++ b/campaign-sendr/scripts/upload.media.php @@ -28,7 +28,7 @@ exit; } -// poll for job status, could be replaced by a webhook (http://thecallr.com/docs/webhooks) +// poll for job status, could be replaced by a webhook (http://www.callr.com/docs/webhooks) $job; do { sleep(1); diff --git a/click2call-web/README.html b/click2call-web/README.html deleted file mode 100644 index f5e3480..0000000 --- a/click2call-web/README.html +++ /dev/null @@ -1,183 +0,0 @@ -README -
- -

-README Click to Call Web sample

- -

-Table of contents

- - - -
- -

-General Information

- -

This demo uses environment variables set in the file .htaccess found in the src/ directory, that needs to be defined for your use case

- -
SetEnv CALLR_LOGIN <your callr login>
-SetEnv CALLR_PASS <your callr password>
-SetEnv CALLR_TARGET <target number>
-SetEnv APP_ID <app id>
-
- - - -

A typical .htaccess for Bob Smith, with a telephone number of '+336123456789' and a predefined click to call application would look like the following:

- -
SetEnv CALLR_LOGIN bobsmith
-SetEnv CALLR_PASS mySecr3tp@ssw0rd
-SetEnv CALLR_TARGET +336123456789
-SetEnv APP_ID H45HC0D3
-
- -

-if no predefined click to call application is being used, please leave APP_ID blank, or remove the line completely.

- -
- -

-Installation

- -

-Docker

- -

Docker is available for download on their website https://www.docker.com/

- -

On Windows make sure you install Docker toolbox, or Docker for Windows (Requires Microsoft Windows 10 Professional or Enterprise 64-bit) -and use the Kitematic application to manage your containers and view their logs and output (installed by default)

- -

-docker-compose

- -

On Windows and Mac the docker-compose utility is installed automatically with docker-toolbox
-For other users, follow the instructions on the official Docker website here

- -
- -

-Running

- -
    -
  1. Before running the docker-compose up c2cwebdemo command, please modify the .htaccess file found in the src directory.

  2. -
  3. If using MacOS / Windows launch the Docker quickstart terminal, and use the provided console to run this demo.

  4. -
  5. -

    After installing Docker and docker-compose, run the following command in the same directory as Dockerfile,

    - -
    $ docker-compose up
    -
    - -

    you will see output similar to the following:

    - -
    Building c2cwebdemo
    -Step 1 : FROM php:5.6-apache
    ----> 7374b3b98172
    -Step 2 : RUN apt-get update     && apt-get install -y zip     && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    ----> Using cache
    ----> 82c0a0de5ff7
    -Step 3 : COPY src/ /var/www/html/
    ----> a5dd2bea4c5c
    -Removing intermediate container 5ecde79f4420
    -Step 4 : COPY composer.json /var/www
    ----> 52d9fe05d3c7
    -Removing intermediate container ab5d4eae9847
    -...
    -[Thu Jul 01 01:15:00.301234 2016] [mpm_prefork:notice] [pid 10] AH00163: Apache/2.4.10 (Debian) PHP/5.6.23 configured -- resuming normal operations
    -[Thu Jul 02 01:15:00.301234 2016] [core:notice] [pid 10] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
    -
    -
  6. -
  7. You can then connect to the docker container ip address with http:// to view the website. ( the ip address is displayed with the initial startup of the docker quickstart console )

  8. -
  9. If any modifications are made to the project, you will need to restart the container and rebuild the image, this can be done with the docker-compose command docker-compose up --build.

  10. -
- -

-Windows

- -

When running on windows, you should use the Kitematic utility to view the container output and website.

- -

After launching the docker-compose command, from the Kitematic utility windows, you are able to click on the running container, view the 'web preview' - and launch a browser connection to the website.

- -
- -

-Further help

- - - -

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

- - - -
- - - -
-

-
- diff --git a/click2call-web/README.md b/click2call-web/README.md index d8f4803..697f461 100644 --- a/click2call-web/README.md +++ b/click2call-web/README.md @@ -38,13 +38,24 @@ SetEnv APP_ID H45HC0D3 --- ## Installation -### Docker +### Docker installation Docker is available for download on their website [https://www.docker.com/](https://www.docker.com/products/overview) -On Windows make sure you install [Docker toolbox](https://www.docker.com/products/docker-toolbox), or [Docker for Windows (Requires Microsoft Windows 10 Professional or Enterprise 64-bit)](https://www.docker.com/products/docker#/windows) +#### Windows +On Windows you can install [Docker toolbox](https://www.docker.com/products/docker-toolbox), +or [Docker for Windows (Requires Microsoft Windows 10 Professional or Enterprise 64-bit)](https://www.docker.com/products/docker#/windows) and use the `Kitematic` application to manage your containers and view their logs and output (installed by default) -### docker-compose +#### Mac +On a Mac you can install [Docker toolbox](https://www.docker.com/products/docker-toolbox), +or [Docker for Mac (Requires Apple macOS Yosemite 10.10.3 or above )](https://www.docker.com/products/docker#/mac) +and use the `Kitematic` application to manage your containers and view their logs and output (installed by default) + +#### Linux +Either download and install Docker using your distributions package manager, +or follow the instructions on the official [Docker website here](https://docs.docker.com/engine/installation/linux/) + +### docker-compose installation On Windows and Mac the docker-compose utility is installed automatically with docker-toolbox For other users, follow the instructions on the official [Docker website here](https://docs.docker.com/compose/install/) @@ -91,13 +102,8 @@ After launching the docker-compose command, from the `Kitematic` utility windows --- ## Further help -* You will find API documentation and snippets here at [http://thecallr.com/docs/](http://thecallr.com/docs/) +* You will find API documentation and snippets here at [http://www.callr.com/docs/](http://www.callr.com/docs/) * Or on github in our repository [https://github.com/THECALLR/](https://github.com/THECALLR/) - -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 -* US: +1 (646) 982-0830 --- diff --git a/click2call-web/composer.json b/click2call-web/composer.json index 93765db..1782364 100644 --- a/click2call-web/composer.json +++ b/click2call-web/composer.json @@ -1,5 +1,5 @@ { "require": { - "callr/sdk-php": "dev-master" + "callr/sdk-php": "^0.9" } } \ No newline at end of file diff --git a/click2call-web/src/index.php b/click2call-web/src/index.php index a3a1ccd..a2d36f3 100644 --- a/click2call-web/src/index.php +++ b/click2call-web/src/index.php @@ -57,158 +57,6 @@

-
- - - -

-README Click to Call Web sample

- -

-Table of contents

- - - -
- -

-General Information

- -

This demo uses environment variables set in the file .htaccess found in the src/ directory, that needs to be defined for your use case

- -
SetEnv CALLR_LOGIN <your callr login>
-SetEnv CALLR_PASS <your callr password>
-SetEnv CALLR_TARGET <target number>
-SetEnv APP_ID <app id>
-
- - - -

A typical .htaccess for Bob Smith, with a telephone number of '+336123456789' and a predefined click to call application would look like the following:

- -
SetEnv CALLR_LOGIN bobsmith
-SetEnv CALLR_PASS mySecr3tp@ssw0rd
-SetEnv CALLR_TARGET +336123456789
-SetEnv APP_ID H45HC0D3
-
- -

-if no predefined click to call application is being used, please leave APP_ID blank, or remove the line completely.

- -
- -

-Installation

- -

-Docker

- -

Docker is available for download on their website https://www.docker.com/

- -

On Windows make sure you install Docker toolbox, or Docker for Windows (Requires Microsoft Windows 10 Professional or Enterprise 64-bit) -and use the Kitematic application to manage your containers and view their logs and output (installed by default)

- -

-docker-compose

- -

On Windows and Mac the docker-compose utility is installed automatically with docker-toolbox
-For other users, follow the instructions on the official Docker website here

- -
- -

-Running

- -
    -
  1. Before running the docker-compose up c2cwebdemo command, please modify the .htaccess file found in the src directory.

  2. -
  3. If using MacOS / Windows launch the Docker quickstart terminal, and use the provided console to run this demo.

  4. -
  5. -

    After installing Docker and docker-compose, run the following command in the same directory as Dockerfile,

    - -
    $ docker-compose up
    -
    - -

    you will see output similar to the following:

    - -
    Building c2cwebdemo
    -Step 1 : FROM php:5.6-apache
    ----> 7374b3b98172
    -Step 2 : RUN apt-get update     && apt-get install -y zip     && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    ----> Using cache
    ----> 82c0a0de5ff7
    -Step 3 : COPY src/ /var/www/html/
    ----> a5dd2bea4c5c
    -Removing intermediate container 5ecde79f4420
    -Step 4 : COPY composer.json /var/www
    ----> 52d9fe05d3c7
    -Removing intermediate container ab5d4eae9847
    -...
    -[Thu Jul 01 01:15:00.301234 2016] [mpm_prefork:notice] [pid 10] AH00163: Apache/2.4.10 (Debian) PHP/5.6.23 configured -- resuming normal operations
    -[Thu Jul 02 01:15:00.301234 2016] [core:notice] [pid 10] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
    -
    -
  6. -
  7. You can then connect to the docker container ip address with http:// to view the website. ( the ip address is displayed with the initial startup of the docker quickstart console )

  8. -
  9. If any modifications are made to the project, you will need to restart the container and rebuild the image, this can be done with the docker-compose command docker-compose up --build.

  10. -
- -

-Windows

- -

When running on windows, you should use the Kitematic utility to view the container output and website.

- -

After launching the docker-compose command, from the Kitematic utility windows, you are able to click on the running container, view the 'web preview' - and launch a browser connection to the website.

- -
- -

-Further help

- - - -

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

- - - -
- - - -