PHP code example of requestlab / xiti-analytics

1. Go to this page and download the library: Download requestlab/xiti-analytics 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/ */

    

requestlab / xiti-analytics example snippets

 php


stLab\XitiAnalytics;

// ...
 php


use RequestLab\XitiAnalytics\Query;

$query = new Query();

$query->setStartDate(new \DateTime('-1 Day'));
$query->setEndDate(new \DateTime('-1 Day'));

$query->setSpace(99999);
$query->setColumns(array('m_visits', 'm_page_loads'));
$query->setSort(array('-m_visits'));

 php


use RequestLab\XitiAnalytics\Client;

$client = new Client();
$client->setLogin('Login');
$client->setPassword('Password');

 php


use RequestLab\XitiAnalytics\Service;

$service = new Service($client);
$client->query($query);

 php


$columns = $response->getColumns();
$rows    = $response->getRows();
$totals  = $response->getTotals();