1. Go to this page and download the library: Download visualappeal/piwik-php-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/ */
visualappeal / piwik-php-api example snippets
use VisualAppeal\Matomo;
$matomo = new Matomo('http://stats.example.org', 'my_access_token', 'siteId');
$matomo->setRange('2012-01-14', '2012-04-30'); //All data from the first to the last date
$matomo->setRange('2012-01-14', Matomo::DATE_YESTERDAY); //All data from the first date until yesterday
$matomo->setRange('2012-01-14'); //All data from the first date until now
$matomo->setPeriod(x);
$matomo->setDate('2012-03-03');
Case x of PERIOD_DAY the report is created for the third of march, 2012
Case x of PERIOD_WEEK the report is created for the first week of march, 2012
Case x of PERIOD_MONTH the report is created for march, 2012
Case x of PERIOD_YEAR the report is created for 2012