chrishenrique/laravel-requests-monitor
Lightweight Laravel package to monitor, log, and analyze HTTP requests and custom app actions. Supports middleware auto-tracking, manual event registration, dedicated DB connection, configurable retention/pruning, and works with Laravel 7+ (PHP 7.4/8+).
Install via Composer:
composer require vendor/package-name
Publish the package config (if needed) to customize new settings:
php artisan vendor:publish --provider="Vendor\PackageName\PackageServiceProvider" --tag="config"
Key new feature: The execution_ms column is now available in query results by default—no additional setup required. For URL changes, ensure your existing queries use the updated url column (now standardized to canonical_url).
First use case: Fetch performance metrics alongside URLs:
$results = PackageName::query()->get();
foreach ($results as $item) {
echo "URL: {$item->canonical_url} | Time: {$item->execution_ms}ms";
}
Leverage the new execution_ms column for performance tracking:
$slowQueries = PackageName::where('execution_ms', '>', 500)->get();
Update your config/package-name.php to adjust:
url_column (now defaults to canonical_url)execution_threshold (for alerts)enabled_metrics (toggle execution_ms visibility)SELECT statements to include execution_ms.PackageName\Events\MetricUpdated to react to new data.return $this->transform($item, [
'url' => 'canonical_url',
'execution_time' => 'execution_ms',
]);
url column is now canonical_url by default. Update all queries/models:
// Old (deprecated)
$item->url;
// New
$item->canonical_url;
url_column to a custom value, ensure it’s updated in the new config or the package will default to canonical_url.execution_ms: Verify the config key enabled_metrics.execution_ms is set to true.php artisan vendor:clear-cache if the new column isn’t appearing in queries.metrics config array:
'custom_metrics' => [
'memory_usage' => 'memory_usage_kb',
],
class PerformanceScope {
public function slowQueries($threshold = 500) {
return function ($query) use ($threshold) {
return $query->where('execution_ms', '>', $threshold);
};
}
}
Use the execution_ms column to optimize queries:
// Cache results under 100ms
$fastResults = PackageName::where('execution_ms', '<=', 100)->remember(60);
How can I help you explore Laravel packages today?