2017 © Pedro Peláez
 

library user-api-v1

PHP class for Zadarma API

image

zadarma/user-api-v1

PHP class for Zadarma API

  • Monday, June 4, 2018
  • by zadarma
  • Repository
  • 9 Watchers
  • 34 Stars
  • 8,441 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 15 Forks
  • 3 Open issues
  • 3 Versions
  • 14 % Grown

The README.md

Zadarma API - User class

An official PHP class for work with Zadarma API., (*1)

Allows to work with all API methods (including VoIP, PBX, CallBack etc)., (*2)

Requirements:

  • PHP >= 5.5.0
  • cURL
  • TLS v1.2

How to use?

An official documentation on Zadarma API is here., (*3)

Keys for authorization are in personal account., (*4)

Installation

Via Сomposer

composer require "zadarma/user-api-v1"

or just add this line to your composer.json file:, (*5)

"zadarma/user-api-v1"

Via Git

git clone git@github.com:zadarma/user-api-v1.git

\Zadarma_API\Api call code example

<?php
include_once '/PATH/TO/vendor/autoload.php'; 
$api = new \Zadarma_API\Api(KEY, SECRET, USE_SANDBOX);
try{
    $result = $api->getSipStatus('YOURSIP');
    echo $result->sip.' status: '.($result->is_online ? 'online' : 'offline');
} catch (\Zadarma_API\ApiException $e) {
    echo 'Error: '.$e->getMessage();
}

All other examples you can see in the "example file"., (*6)

\Zadarma_API\Client call code example

<?php

include_once '/PATH/TO/lib/Client.php';

$params = array(
    'id' => 'YOURSIP',
    'status' => 'on'
);

$zd = new \Zadarma_API\Client(YOUR_KEY, YOUR_SECRET);
/*
$zd->call('METHOD', 'PARAMS_ARRAY', 'REQUEST_TYPE', 'FORMAT', 'IS_AUTH');
where:
- METHOD - a method API, started from /v1/ and ended by '/';
- PARAMS_ARRAY - an array of parameters to a method;
- REQUEST_TYPE: GET (default), POST, PUT, DELETE;
- FORMAT: json (default), xml;
- IS_AUTH: true (default), false - is method under authentication or not.
*/
$answer = $zd->call('/v1/sip/redirection/', $params, 'put');

$answerObject = json_decode($answer);

if ($answerObject->status == 'success') {
    echo 'Redirection on your SIP "' . $answerObject->sip . " has been changed to " . $answerObject->current_status . ".";
} else {
    $answerObject->message;
}

All other examples you can see in the "examples" folder., (*7)

The Versions

04/06 2018

dev-master

9999999-dev https://github.com/zadarma/user-api-v1

PHP class for Zadarma API

  Sources   Download

MIT

by Avatar zadarma

api sip zadarma pbx free calls

23/06 2016

1.0.1

1.0.1.0 https://github.com/zadarma/user-api-v1

PHP class for Zadarma API

  Sources   Download

MIT

by Avatar zadarma

api sip zadarma pbx free calls

03/11 2015

1.0

1.0.0.0 https://github.com/zadarma/user-api-v1

PHP class for Zadarma API

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

by Avatar zadarma

api sip zadarma pbx free calls