Download the PHP package sharoff/mango-office-api without Composer

On this page you can find all versions of the php package sharoff/mango-office-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mango-office-api

Библиотека для работы с API mango-office.ru

Установка

composer require sharoff/mango-office-api

Инициализация

Для простой и быстрой инициализации создан Helper который хранить в себе инстанс класса работающий с API. Для первоначальной инициализации скрипта необходимо задать API ключ и ключ шифрования.

// Подключаем автолоад
require __DIR__ . '/../vendor/autoload.php';
// Просто для короткой записи
use Sharoff\Mango\Api\MangoHelper;
// Задание API ключа и ключа шифрования
MangoHelper::setApiKey('*********************************')
           ->setApiSalt('*********************************');

Для удобства использования создан PHP DOC, который позволяет работать автозаполнению в IDE

Получение входящих данных

Mango-office обращается к определенному URL адресу. Каждый адрес прописан в документации (http://www.mango-office.ru/upload/api/MangoOffice_VPBX_API_v1.3.pdf) Данная библиотека поможет проверить подпись от манго и если что-то пойдет не так, сделает ответ в формате json, нужным кодом и заголовком. Для получения данных достаточно после инициализации выполнить строчку:

$data = MangoHelper::getMethodData();

В переменную $data придет json_decode полученных данных от манго.

Совершение звонка

Для совершения звонка достаточно знать внутренний номер сотрудника и кому вы хотите совершить вызов:

$data = MangoHelper::sendCall('10', '7912*******');

Завершение звонка

Для завершения звонка необходимо выполнить команду:

MangoHelper::sendCallHangup($command_id, $call_id)

Где $command_id и $call_id придут при совершении звонка

Получение статистики

В результате выполнения команды будет массив, с объектами MangoOfficeStat, с помощью которого можно получить с автокомплитом нужные параметры Данные объекта будут в формате как и $fields

$stats = MangoHelper::getStat($date_from, $date_to, $from = 0, $from_number = null, $to = null, $to_number = null, $fields = null, $request_id = null);
foreach ($stats as $stat) {
    /** @var \Sharoff\Mango\Api\MangoOfficeStat $stat */
    echo $stat->start->format('d.m.Y H:i:s') . PHP_EOL;
}

Параметры по умолчанию $fields

$fields = [
    'records',
    'start',
    'finish',
    'from_extension',
    'from_number',
    'to_extension',
    'to_number',
    'disconnect_reason'
];

Возможные поля $fields и формат полей

$available_fields = [
    // Массив с идентификаторами записей
    'records'           => 'array',
    // Будет в объекте Carbon 
    'start'             => 'timestamp',
    // Будет в объекте Carbon
    'finish'            => 'timestamp',
    // строка
    'from_extension'    => 'string',
    // строка
    'from_number'       => 'string',
    // строка
    'to_extension'      => 'string',
    // строка
    'to_number'         => 'string',
    // строка
    'disconnect_reason' => 'string',
    // строка
    'entry_id'          => 'string',
];

All versions of mango-office-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/http-foundation Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sharoff/mango-office-api contains the following files

Loading the files please wait ....