PHP code example of mattitjaab / matomo-proxy-laravel

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

    

mattitjaab / matomo-proxy-laravel example snippets


return [
    'enabled' => env('MATOMO_ENABLED', true),

    // Full Matomo tracking endpoint (must SITE_ID', null),

    // Optional token_auth (can be null for anonymous tracking)
    'token' => env('MATOMO_TOKEN', null),

    // Paths that should never be tracked
    'ignore' => [
        'telescope/*', 'horizon/*', 'health', '_debugbar/*',
    ],

    // HTTP client behavior
    'timeout' => env('MATOMO_TIMEOUT', 2),
    'retry' => [
        'times' => env('MATOMO_RETRY_TIMES', 0),
        'sleep' => env('MATOMO_RETRY_SLEEP_MS', 100), // milliseconds
    ],
];

->withMiddleware(function (Middleware $middleware): void {
    $middleware->append(\MattitjaAB\MatomoProxyLaravel\Middleware\MatomoProxyLaravelMiddleware::class);
})
bash
php artisan vendor:publish --tag="matomo-proxy-laravel-config"
dotenv
MATOMO_ENABLED=true
MATOMO_BASE_URL=https://analytics.example.com/matomo.php
MATOMO_SITE_ID=1
MATOMO_TOKEN=null
MATOMO_TIMEOUT=2
MATOMO_RETRY_TIMES=0
MATOMO_RETRY_SLEEP_MS=100