PHP code example of snicksnk / maitavr-api

1. Go to this page and download the library: Download snicksnk/maitavr-api 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/ */

    

snicksnk / maitavr-api example snippets



use MaitavrApi\Api;
use MaitavrApi\Request\Users\Count;
use MaitavrApi\Request\Users\UList;

//Подключаем автолоадер, если не используется composer
я, которые мы хотим видить в ответе
$request = new UList(array(UList::ROW_FIRSTNAME, UList::ROW_LASTNAME, UList::ROW_EMAIL));

//Добавляем фильтр по email адресу в запрос 
$request->addFilter(UList::FILTER_EMAIL, array('[email protected]', '[email protected]'));

// Делаем запрос на сервер и получаем ответ в виде массива
$response = $api->request($request);
var_dump($response);
/*
array(2) {
  [0] =>
  array(3) {
    'firstname' =>
    string(18) "Александр"
    'lastname' =>
    string(12) "Галкин"
    'email' =>
    string(12) "[email protected]"
  }
  [1] =>
  array(3) {
    'firstname' =>
    string(12) "Михаил"
    'lastname' =>
    string(14) "Сидоров"
    'email' =>
    string(21) "[email protected]"
  }
}
*/
sh
php composer.phar update