Video
Description
Record and manage metrics in your Laravel application
Recording Metrics
Record a metric using the Metrics facade:
use DirectoryTree\Metrics\MetricData;use DirectoryTree\Metrics\Facades\Metrics; Metrics::record(new MetricData('signups'));
Or using the metric global helper:
metric('signups')->record();
Or using the PendingMetric class:
use DirectoryTree\Metrics\PendingMetric; PendingMetric::make('signups')->record();
Which ever method you use, metrics are recorded in the same way. Use whichever you prefer.
For the rest of the documentation, we will use the metric helper for consistency and brevity.
Recording with Values
By default, metrics have a value of 1. You may specify a custom value in the record method:
// Track multiple API calls at oncemetric('api:requests')->record(10); // Track batch job completionsmetric('jobs:completed')->record(250);
If you record the same metric multiple times, the values will be summed:
metric('auth:logins')->record(); // value: 1metric('auth:logins')->record(); // value: 1 // Database will contain one metric with value: 2
Related Content on Laravel Daily
Video
Recent Courses on Laravel Daily
Marketing for Developers in 2026
7 lessons
52 min
AI Agents/IDEs for Laravel: May 2026 (Claude Code, Codex, OpenCode, etc)
7 lessons
52 min
Roles and Permissions in Laravel 13
14 lessons
57 min