Install the client with Composer:
composer require seoapi-ru/api-client-php
Create client with username and password to authenticate:
$client = ApiClient::fromCredentials(
'username',
'password',
new HttpClientFactory()
);
...or using predefined session token.
// ... first steps: see previous example
$client = ApiClient::fromToken(self::VALID_TOKEN, self::BASE_URL, new HttpClientFactory());
Use client methods to call API counterparts.
$regions = $client->getRegions('москва');
$stats = $client->getDailyStatsReport('google', 2019, 2);
// etc, see tests
For expected JSON response formats refer JSON schemas located at tests/Functional/**.*Test.php