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 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

Laravel XHProf - Library for profiling in production.

Frequently asked questions about Laravel Xhprof
How do I install bavix/laravel-xhprof in a Laravel app?
Install it as a dev dependency with composer require-dev bavix/laravel-xhprof, then publish the package config and register the service provider and middleware. The package is a thin wrapper, so no application code changes are needed beyond that. The real prerequisite is having the ext-xhprof PECL extension available in the PHP environment where you intend to profile.
Does bavix/laravel-xhprof require the xhprof PHP extension?
Yes. It is a service-provider and middleware wrapper around the XHProf PECL extension, so the extension has to be compiled or pre-built into every environment where profiling runs: dev containers, CI images and any staging box used for load analysis. The original Facebook extension is effectively unmaintained, so most teams build against a community fork, and base image family (Alpine versus Debian) plus PHP minor-version headers are where the recurring toil lands. Check whether your installed version declares ext-xhprof as a hard requirement or only suggests it, since that decides whether composer install fails on machines without the extension.
Which Laravel and PHP versions does bavix/laravel-xhprof 2.1 support?
Release 2.1.0 is functionally additive: it adds Laravel 13 support on top of 2.0.6 with no deprecations, removals or config schema changes. Because Laravel 13 implies PHP 8.3+, treat PHP 8.3 or newer as the practical floor for that version. Teams not yet on Laravel 13 can stay on 2.0.x with no functional loss, so sequence this upgrade independently of any framework upgrade.
Is it safe to enable bavix/laravel-xhprof in production?
The package is explicitly built for lightweight request-level profiling in production, which is where slow-endpoint data is most useful. The highest-impact failure mode is accidental enablement: misconfigured env gating means per-request overhead, disk growth from stored profiles and potentially an exposed profiling UI. Gate the middleware behind an explicit environment flag plus auth, and make sure the default production config leaves it off.
Should bavix/laravel-xhprof be a require-dev dependency?
Yes. It is a diagnostic and developer package, not a runtime business dependency, so it belongs in require-dev and should never sit on the critical path. That also keeps it out of production installs where ext-xhprof is not compiled in. Decide internally whether this is a standing capability or a one-off investigation tool, and give it a named owner either way.
How is bavix/laravel-xhprof different from Laravel Telescope or Xdebug?
Telescope, Debugbar and similar tools give you request-level timing, query counts and event insight. XHProf produces a hierarchical function-level callgraph, which is far more actionable when the question is specifically why an endpoint is slow. Xdebug's profiler is excellent locally but too heavy for production-like traffic, so this package complements rather than replaces those tools.
Does bavix/laravel-xhprof include a viewer UI, or do I need XHGui?
The wrapper handles starting and stopping profiling in the HTTP kernel lifecycle and can optionally persist or expose the resulting profile data. Whether you get a bundled viewer or hand off to XHGui or another tool determines the data-retention and access-control surface you inherit, so inspect the config's storage option before enabling it anywhere shared. If you need long-term storage and a browsing UI, a dedicated viewer is usually the safer choice.
What is the per-request overhead of XHProf profiling in Laravel?
XHProf is comparatively lightweight next to Xdebug, which is why request-level profiling in production is feasible at all, but the overhead is still non-zero and scales with request complexity. Check whether the package exposes sampling or a rate limit so you profile a fraction of traffic instead of every request. Watch retained-profile disk usage too, since storage growth compounds faster than the CPU cost.
Is bavix/laravel-xhprof actively maintained?
It is a single-maintainer project with largely bot-driven maintenance; 2.1.0 is mostly Dependabot workflow bumps plus Laravel 13 support. That forward-compatibility signal is positive and the upgrade risk from 2.0.6 is effectively nil, but single-maintainer status is only acceptable for a dev-only tool. The longer-lived risk is upstream, because the wrapper is only as healthy as the XHProf extension or fork beneath it.
What are the alternatives to bavix/laravel-xhprof for Laravel profiling?
Laravel Telescope, Laravel Debugbar and Xdebug cover most local and coarse production timing needs, while Blackfire or Tideways provide hosted continuous profiling with a managed UI. Choose XHProf when you specifically want hierarchical function-level callgraphs without a commercial agent or a heavy local profiler. Because the package is purely additive, moving away costs nothing more than removing the middleware and provider registration.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console