fetzi/server-timing
Add Server-Timing headers to Laravel responses and expose app, database, and custom performance metrics in your browser's DevTools Performance tab. Lightweight middleware for profiling without extra tooling.
Architecture fit. fetzi/server-timing is a narrowly scoped instrumentation library: it collects named timers during request handling and serializes them into the W3C Server-Timing response header, which browsers surface in DevTools and via the PerformanceServerTiming JS API. This positions it as a developer-facing latency breakdown layer, not an observability platform. For a Laravel monolith or API this is a good fit when the goal is "let engineers see where the 800ms went without leaving the browser," and a poor fit as a substitute for APM (no aggregation, no percentile math, no cross-request storage, no alerting). Architecturally it is a thin middleware + timer registry — low conceptual weight, easy to reason about, unlikely to entangle with domain code.
Integration feasibility. The package is PSR-oriented (PSR-7/PSR-15 style middleware and a timer abstraction). Laravel integration is therefore either an officially documented adapter or a ~40-line custom middleware that resolves timers from the container and appends the header to the response. Verify before committing:
Overall integration risk is low: the package cannot corrupt business logic, only attach a header.
Technical risk.
Key questions.
X-Server-Timing: 1)?Stack fit. Laravel 10/11/12 on PHP 8.1+ is a natural fit: Composer install, one middleware registration in bootstrap/app.php (L11+) or Http/Kernel.php, optional config file for metric allow-listing. No database, queue, or infrastructure dependency. This is a same-sprint change, not a project.
Migration path. Additive and reversible by removing one middleware line or flipping a config flag — no schema changes, no data migration, no client contract change. The only "migration" concern is retiring it later if OTel supersedes it, which is a deletion, not a migration.
Compatibility. Verify the composer.json PHP and PSR constraints against our runtime before adoption. Check Laravel version support explicitly — Laravel's middleware contract is not PSR-15, so any adapter is Laravel-specific and version-sensitive. Test the header assertion in the existing feature-test suite to catch regressions on framework upgrades.
Sequencing.
curl -I.db, cache, ext_api, app) and a hard cap on metric count. Without a naming policy this decays into noise.X-Server-Timing: 1) for production if we want it live without exposing internals to all traffic.Maintenance. Low code surface, high bus-factor exposure. Pin to an exact version, vendor the source if the maintainer goes quiet, and budget ~4 hours/quarter to review upstream releases. Because the library is small and MIT, the realistic worst case is "we own a 500-line fork," which is acceptable — but someone must be named as owner.
Support. Community-only; no SLA, no vendor escalation. Acceptable for a developer-tooling concern, unacceptable if any customer-facing SLA or compliance report depends on these numbers. Position it explicitly as an internal DX aid, never as an SLO measurement source.
Scaling. Per-request CPU overhead is negligible (a few hrtime calls). The scaling concerns are elsewhere:
Failure modes.
cache;desc=hit metric.Ramp-up. Near-zero for a mid-level Laravel engineer: one day to integrate, one day to establish conventions. The real onboarding cost is cultural — teaching the team to reach for the browser timing panel before adding log statements, and to keep metric names curated. If that habit doesn't form inside a month, the package is dead weight and should be removed rather than maintained.
How can I help you explore Laravel packages today?