1. Go to this page and download the library: Download itsemon245/lamet 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/ */
protected function schedule(Schedule $schedule): void
{
$schedule->command('lamet:flush')->everyFiveMinutes();
}
use Itsemon245\Lamet\Facades\Metrics;
// Record an API request
Metrics::increment('api.requests', 1, [
'endpoint' => '/users',
'method' => 'GET',
'status_code' => 200
]);
protected function schedule(Schedule $schedule): void
{
// Flush metrics every 5 minutes
$schedule->command('lamet:flush')->everyFiveMinutes();
// Clean old metrics daily at 2 AM (keep last 90 days)
// $schedule->command('lamet:clean --days=90 --force')->dailyAt('02:00');
}