bavix/laravel-xhprof
Integrates XHProf profiling into Laravel so you can capture and inspect performance data for requests and identify slow endpoints. Provides simple configuration and middleware for lightweight, request-level profiling.
Architecture fit: bavix/laravel-xhprof is a thin Laravel service-provider + middleware wrapper around the XHProf PECL extension. It hooks into the HTTP kernel lifecycle to start/stop profiling and (optionally) persist or expose profile data. This is a natural fit for a Laravel codebase because it requires no application code changes beyond registering the provider and middleware. It is fundamentally a developer/diagnostic package, not a runtime business dependency, and should be scoped as require-dev.
Integration feasibility: Low-friction on the PHP side (composer require-dev bavix/laravel-xhprof, publish config, enable middleware per-environment), but the real integration cost is the native dependency: ext-xhprof must be compiled or pre-built into every environment where profiling runs — dev containers, CI images, and any staging box used for load analysis. That is where most of the effort will land, not in the package itself.
2.1.0 review: The release is functionally additive and non-breaking. Two of three changes are Dependabot bumps to shared GitHub workflow files (CI-only, no runtime effect). The substantive change is Laravel 13 support, which signals the package is being kept forward-compatible rather than abandoned. No deprecations, no removals, no config schema changes. Risk of upgrading from 2.0.6 → 2.1.0 is effectively nil; risk of not upgrading is only that Laravel 13 adoption would be blocked.
Technical risk:
Key questions:
^2.1 cover (Laravel 13 implies PHP 8.3+)?ext-xhprof declared as a hard requirement or merely suggested? (Affects whether composer install fails on machines without the extension.)Stack fit: Strong fit for a Laravel monolith or modular monolith where the team needs function-level callgraph profiling (rather than the coarser timing that Telescope/Debugbar provide). It complements, rather than replaces, Laravel Telescope and Xdebug. If the team's need is "why is this endpoint slow," XHProf's hierarchical output is genuinely more actionable than request-timing alone.
Migration path: There is nothing to migrate — the package is purely additive and dev-scoped. Teams currently on 2.0.x can move to 2.1.0 as a patch-level upgrade; teams not yet on Laravel 13 can stay on 2.0.x with no functional loss. Do not couple this upgrade to a framework upgrade; sequence it independently.
Compatibility: The only hard compatibility variables are (a) PHP version required by Laravel 13, (b) ext-xhprof availability per base image, and (c) whether the package's dev-dependency chain conflicts with existing dev tooling (Telescope, Debugbar, PHPStan/Rector). Resolve these with a throwaway branch and composer why-not before committing.
Sequencing:
bavix/laravel-xhprof:^2.1 to require-dev in a scratch branch; confirm constraint resolution against the current Laravel/PHP matrix.pecl install xhprof), cache the layer. This is the true "install" step.production.Maintenance: Runtime code footprint is trivial; maintenance burden is concentrated in the build layer (keeping ext-xhprof compiling across PHP upgrades and base-image changes) and in Composer churn. Note that 2.1.0's changelog is two-thirds CI-config bumps — a signal that the project's cadence is housekeeping-driven, so expect frequent low-value releases. Mitigate with a pinned constraint and a scheduled (not per-PR) review cadence.
Support: Community-only. No vendor, no SLA, no security-response commitment. That is acceptable for a dev-only, env-gated tool and unacceptable if anyone proposes enabling it in production for continuous profiling. Make that boundary explicit in writing.
Scaling: Cost scales with requests profiled, not with users. If confined to local dev, impact is zero. If enabled on shared staging under load, expect measurable latency inflation, meaningful disk growth from stored profiles, and a profile store that needs its own retention policy and cleanup job. Sampling configuration — not raw throughput — is the lever.
Failure modes:
Ramp-up: Low for anyone already fluent in Laravel middleware and Composer; roughly half a day to install, instrument one route, and read a callgraph. The real skill gap is interpretation — reading inclusive/exclusive wall-time and call counts to find the actual bottleneck — plus familiarity with a viewer (XHGui or the bundled UI). Budget a short walkthrough for the team rather than assuming the tool is self-explanatory. Overall: adopt as a scoped, opt-in developer tool; do not treat it as platform infrastructure.
How can I help you explore Laravel packages today?