Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Xhprof Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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:

  • Upstream health of XHProf. The original Facebook XHProf extension is effectively unmaintained; most users depend on community forks. This is a long-lived, low-severity but permanent risk — the wrapper is only as healthy as the extension beneath it.
  • Accidental production enablement. Misconfigured env gating leads to per-request overhead, disk growth from stored profiles, and potentially an exposed profiling UI. This is the highest-impact failure mode and should be treated as a config-safety concern, not a code concern.
  • Native build fragility. Alpine vs. Debian base images, PHP minor-version build headers, and CI cache invalidation all create recurring toil.
  • Maintainer concentration. Single-maintainer project with bot-driven maintenance. Acceptable for a dev-only tool; not acceptable for anything on the critical path.

Key questions:

  1. What is the exact Composer constraint matrix — which Laravel and PHP versions does ^2.1 cover (Laravel 13 implies PHP 8.3+)?
  2. Is ext-xhprof declared as a hard requirement or merely suggested? (Affects whether composer install fails on machines without the extension.)
  3. Does the package ship the profile storage/UI, or does it hand off to XHGui / a separate viewer? This determines the data-retention and access-control surface we inherit.
  4. What is the per-request overhead and is sampling configurable?
  5. Are profiling routes/env flags on by default, and are they gated behind auth + non-production environments out of the box?
  6. Who owns this internally — is it a standing capability or a one-off investigation tool?

Integration Approach

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:

  1. Pin and verify — add bavix/laravel-xhprof:^2.1 to require-dev in a scratch branch; confirm constraint resolution against the current Laravel/PHP matrix.
  2. Bake the extension into images — update devcontainer/Dockerfile and CI images (pecl install xhprof), cache the layer. This is the true "install" step.
  3. Default to off — ship config with profiling disabled, enabled only via an explicit local env flag; add a guard that refuses to boot in production.
  4. Pilot on one team/service — instrument a single known-slow endpoint, produce a callgraph, and validate that the output is actionable for the team.
  5. Document — a short internal runbook: how to enable, where profiles land, how to read them, how to clean up.
  6. Decide — promote to a standard dev-environment capability only if the pilot produces a real performance win; otherwise leave it as an opt-in tool.

Operational Impact

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:

  • Extension absent after a base-image rebuild → autoload/boot error that looks like a package bug but is an infrastructure gap. Most likely failure.
  • Env flag flipped on in production → latency regression, disk exhaustion, or an unauthenticated profiling endpoint. Highest impact.
  • PHP minor upgrade outpaces the extension build → CI breakage on an unrelated PR, causing confusion.
  • Unbounded profile retention → storage cost creep with no owner.
  • Upstream XHProf fork abandonment → eventual hard block on a future PHP version, requiring either replacement (Tideways/SPX) or removal.

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package