PHP code example of teraone / matomo-client

1. Go to this page and download the library: Download teraone/matomo-client 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/ */

    

teraone / matomo-client example snippets



// get the Matomo Client
$matomoClient = app()->get('matomo-client');

// get Visits of this month
$matomo->setDate(now(), MatomoClient::PERIOD_MONTH)
       ->setFilterLimit(10) // defaults to 100
       ->getVisits()
       ->json();



// get Event Names of the last week
$matomo->setDate(now()->subWeek(), MatomoClient::PERIOD_RANGE, now())
        ->getEventName()
        ->json();


Http::fake(
  'https://matomo.test/index.php*' => \Http::response(['value' => 123], 200),
);


bash
php artisan vendor:publish