nivseb/lara-monitor
Lara Monitor is a lightweight monitoring package for Laravel that gives you visibility into your application's activity so you can spot issues early. Simple to install and integrate, it helps you keep your app healthy and responsive.
nivseb/lara-monitor is an in-app APM/tracing layer for Laravel: it records requests and the nested spans inside them so you can see where time is spent without wiring up an external agent. v1.2.0 is a good entry point — it adds span recording limits, Laravel 13 support, and PHP 8.5 support, and the test suite moved to Pest 4.
Minimum steps:
composer require nivseb/lara-monitor (v1.2.0 requires a modern Laravel/PHP combination — Laravel 13 and PHP 8.5 are now explicitly supported, so bump your platform constraints if you were holding back).php artisan vendor:publish --tag=lara-monitor-config (check the package README for the exact tag) and review it before enabling anything in production.First use case to try: wrap one slow endpoint (or one queued job) and look at the span breakdown. That immediately tells you whether the granularity is useful for your debugging workflow or whether you need to tune what gets recorded.
Where to look first in the codebase: the service provider (what gets bound and auto-registered), the config file (all the toggles and, new in this release, the span limiting settings), and the middleware/job hooks that start and stop recording.
Instrument the boundaries, not the internals. The natural pattern is one span per meaningful unit of work: an HTTP request, a queued job, a console command, an outbound HTTP call. Let the package handle the request boundary automatically and add manual spans around the expensive things you actually care about (a reporting query, a third-party API call, a batch loop).
// Manual span around an expensive operation
$result = monitor()->span('report:generate', function () use ($range) {
return $this->reportService->build($range);
});
Use the new span limits as a production guardrail, not a dev tool. In v1.1.x, a pathological request (a loop that creates spans per item) could quietly generate an unbounded number of spans per trace. Configure the limit deliberately: pick a ceiling per trace that is comfortably above your normal worst case, so you cap runaway traces without truncating legitimate ones. In local/staging, set it high (or disable) so you don't lose detail while debugging.
Pair it with sampling. Limiting spans per trace and sampling traces are complementary: sampling controls how many traces you keep; the new limit controls how big each kept trace can get. Use sampling for volume and the span limit for the outliers.
Integrate at the job/dispatch layer for queue-heavy apps. Wrap handle() in a span tied to the job class name, and tag it with the job's identifying payload keys (not the whole payload — see gotchas). This gives you a clean per-job-type latency picture across the whole app with very little code.
Keep instrumentation out of domain code where you can. Prefer decorators, middleware, or event listeners over sprinkling span calls through services. It keeps the business logic testable without the monitor installed, and makes it trivial to disable monitoring in a given environment.
CI usage. The Laravel 13 / PHP 8.5 support means you can run a modern matrix; make sure your test environment either disables recording or points at an in-memory/fake store so the suite doesn't write traces on every test.
php artisan config:cache will freeze your span limit and sampling values. Any change requires a re-cache; a surprising number of "the setting isn't working" reports are this.queue:restart (and reload Octane) or you'll see inconsistent behaviour across workers.1.x minor with a genuine feature addition plus new framework/PHP support. Pin to ^1.2 and read the diff if you're on Laravel 13 or PHP 8.5 — those are the combinations most likely to surface the less-travelled paths in a package this size.How can I help you explore Laravel packages today?