PHP code example of ufee / amoapi-v4

1. Go to this page and download the library: Download ufee/amoapi-v4 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/ */

    

ufee / amoapi-v4 example snippets


$api = \Ufee\AmoV4\ApiClient::setInstance([
    'domain'        => 'yourdomain',
    'client_id'     => '8a8135d4-31ca-47...',
    'client_secret' => 'zMZFNnho8FozhrDzxrbA9xuR9...',
    'redirect_uri'  => 'https://yoursite.com/auth/callback',
    'zone'          => 'ru', // или 'com' для Kommo
]);

// первичная авторизация (один раз)
// $url = $api->oauth->getUrl();
// $api->oauth->fetchToken($_GET['code']);

// или долгосрочный токен
// $api->oauth->setLongToken($long_token);

$leads = $api->leads()->get();
foreach ($leads as $lead) {
    echo $lead->name . "\n";
}