novofon / user-api-v1
PHP class for Novofon API
v2.0.3
2024-09-02 11:07 UTC
Requires
- php: >=5.5.0
- ext-curl: *
This package is not auto-updated.
Last update: 2025-05-12 14:09:14 UTC
README
An official PHP class for work with Novofon API.
Allows to work with all API methods (including VoIP, PBX, CallBack etc).
Requirements:
- PHP >= 5.5.0
- cURL
- TLS v1.2
How to use?
An official documentation on Novofon API is here.
Keys for authorization are in personal account.
Installation
Via Сomposer
composer require "novofon/user-api-v1"
or just add this line to your composer.json
file:
"novofon/user-api-v1"
Via Git
git clone git@github.com:novofon/user-api-v1.git
\Novofon_API\Api call code example
<?php include_once '/PATH/TO/vendor/autoload.php'; $api = new \Novofon_API\Api(KEY, SECRET); try{ $result = $api->getSipStatus('YOURSIP'); echo $result->sip.' status: '.($result->is_online ? 'online' : 'offline'); } catch (\Novofon_API\ApiException $e) { echo 'Error: '.$e->getMessage(); }
All other examples you can see in the "example file".
\Novofon_API\Client call code example
<?php include_once '/PATH/TO/lib/Client.php'; $params = array( 'id' => 'YOURSIP', 'status' => 'on' ); $api = new \Novofon_API\Client(YOUR_KEY, YOUR_SECRET); /* $api->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 = $api->call('/v1/sip/', $params); $answerObject = json_decode($answer);
All other examples you can see in the "examples" folder.