PHP code example of uchi-pro / api-client

1. Go to this page and download the library: Download uchi-pro/api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uchi-pro / api-client example snippets


use UchiPro\ApiClient;
use UchiPro\Identity;
use UchiPro\Orders\Status;

$apiClient = ApiClient::create(Identity::createByLogin('UCHIPRO_URL', 'UCHIPRO_LOGIN', 'UCHIPRO_PASSWORD'));

$currentUser = $apiClient->users()->getMe();
print 'Меня зовут: '.$currentUser->name.PHP_EOL;

$courses = $apiClient->courses()->findBy();
print 'Найдено курсов: '.count($courses).PHP_EOL;

$ordersApi = $apiClient->orders();
$ordersCriteria = $ordersApi->newCriteria();
$ordersCriteria->status = Status::createTraining();
$orders = $ordersApi->findBy($ordersCriteria);
print 'Заявок в статусе обучения: '.count($orders).PHP_EOL;