gladyshev/yandex-direct-client

Useful Yandex.Direct API v5 client.

v4.1.0 2021-07-05 19:35 UTC

README

Современный и удобный PHP-клиент Yandex.Direct API.

Build Status Scrutinizer Code Coverage Scrutinizer Code Quality

Требования

  • PHP 7.2 и выше

Установка

$ composer require gladyshev/yandex-direct-client

Использование

$credentials = \Gladyshev\Yandex\Direct\Credentials::client(
    getenv('_TOKEN_')
); 

$httpClient = new \GuzzleHttp\Client(); // Guzzle 7 или любой другой PSR-18 HTTP-клиент

$client = new \Gladyshev\Yandex\Direct\Client(
    $credentials,
    $httpClient
);

$response = $client->campaigns->get(
    ['Ids' => [123545345, 23423234]],  // SelectionCriteria
    ['Status', 'Currency', 'Funds']    // FieldNames
);

print_r($response);

// [
//     'request_id' => 8695244274068608439,
//     'units_used_login' => 'ttt-agency',
//     'units' => [
//         'debit' => 10, 
//         'rest' => 20828,
//         'limit' => 64000
//     ],
//     'result' => [...]
// ]