teraone/matomo-client

A Matomo API Client Library for Laravel
15,805 1
Install
composer require teraone/matomo-client
Latest Version:v1.2.1
PHP:^8.3
Laravel:11 · 12
Older releases:8 · 9 · 10
License:MIT
Last Updated:Nov 12, 2025
Links: GitHub  ·  Packagist
Maintainer: teraone

A simple Matomo API Client for Laravel.

Latest Version on Packagist Total Downloads GitHub Actions

This package is based on VisualAppeal/Matomo-PHP-API

Installation

You can install the package via composer:

composer require teraone/matomo-client

Publish and edit the configuration file

php artisan vendor:publish
  • Choose matomo-client
  • Update the file app/config/matomo-client.php with your Matomo credentials

Usage

To keep things simple, only JSON is supported. All Methods return a Illuminate\Http\Client\Response


// 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();

Testing

Under the hood this library uses the Laravel HTTP Client.

You can mock all Requests in your tests

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


Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email gotre@teraone.de instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

pushery/matomo-analytics-for-laravel

Privacy-first Matomo analytics for Laravel with cookieless tracking, reports, We...

10,286 4
codeaken/laravel-piwiktracker

Insertion of Piwik tracking code and a hidden mode for hiding your tracking serv...

100 3

Version History

Version Released PHP Laravel License
v1.2.1 ^8.3 ^11.0|^12.0 MIT
v1.2.0 ^8.3 ^11.0|^12.0 MIT
v1.1.1 ^8 ^8.0|^9|^10 MIT
v1.1.0 ^8.0 ^8.0|^9 MIT
v1.0.1 ^8.0 ^8.0|^9 MIT