Weave Code
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
Web Snapshot Profiler Xhprof Bundle

Web Snapshot Profiler Xhprof Bundle Laravel Package

aeatech/web-snapshot-profiler-xhprof-bundle

Symfony bundle for production-friendly web profiling with XHProf and XHGui. Capture snapshot profiles per request, control sampling via route/header/request param matchers, and configure flags for memory/internal function data. Requires PHP 8.2+ and ext-xhprof.

View on GitHub
Deep Wiki
Context7

The package contains symfony bundle to profile web applications with xhprof. It can be used for production profiling.

Frequently asked questions about Web Snapshot Profiler Xhprof Bundle
Can this bundle be used in Laravel applications, or is it strictly for Symfony?
This bundle is designed for Symfony 6.4+ applications and requires Symfony’s bundle system. While Laravel doesn’t natively support Symfony bundles, you could integrate it via a bridge like `symfony/bridge` or use it in a microservice architecture where Symfony handles profiling. For pure Laravel, consider alternatives like Tideways or Blackfire.
How do I install this bundle in a Symfony project?
Use Composer with either auto-install via Flex recipes or manual installation. For Flex, run `composer config extra.symfony.allow-contrib true` and `composer require aeatech/web-snapshot-profiler-xhprof-bundle`. For manual, add the bundle to `config/bundles.php` and enable it in both `dev` and `prod` environments. Ensure PHP 8.2+ and `ext-xhprof` are installed.
What’s the performance overhead of XHProf in production?
XHProf typically adds 5–10% overhead to request processing time. The bundle allows dynamic toggling via headers, request params, or route matchers, so you can disable profiling for non-critical paths. Test in staging first to validate impact on your specific workload.
How do I configure profiling to trigger only for specific routes or users?
Use the `event_matcher` configuration in `aea_tech_web_snapshot_profiler_xhprof.yaml`. Set `is_profile_all_routes: false` and enable either `header` (e.g., `x-profiling-header: 1`) or `request` (e.g., a query param like `?profile=1`). You can also combine this with route-based probability sampling.
Is XHGui required, and how do I set it up?
Yes, XHGui is required for storing and visualizing profiling data. The bundle supports Dockerized XHGui (recommended) or self-hosted instances. Configure the `xhgui.import_uri` in your bundle settings (e.g., `http://xhgui:8080`). Ensure XHGui’s SQLite/MySQL database is backed up and secured.
Does this bundle support Laravel’s service container or event system?
No, this bundle is Symfony-specific and relies on Symfony’s event system and service container. For Laravel, you’d need to adapt it manually or use a Laravel-native profiler like `spatie/laravel-profiler` or commercial tools like Blackfire, which integrate natively with Laravel’s ecosystem.
Can I profile memory usage and internal functions separately?
Yes, configure `xhprof.flags` in the bundle’s YAML to include `MEMORY` or other flags like `CPU`. Enable `collect_additional_info: 1` to gather extra details. This is useful for diagnosing memory leaks or CPU-heavy operations in production.
How do I secure profiling data to avoid exposing sensitive paths?
Profiling data may include stack traces with sensitive routes or parameters. Mitigate risks by restricting XHGui access (e.g., IP whitelisting, authentication) and filtering sensitive data in the bundle’s event matchers. Avoid profiling routes handling PII or payment data unless absolutely necessary.
What Laravel alternatives exist for production profiling?
For Laravel, consider `spatie/laravel-profiler` (dev-focused), `tideways/tideways-laravel` (commercial, low-overhead), or `blackfire/php` (commercial, high-performance). Unlike this bundle, these tools are Laravel-native and may offer better integration with Laravel’s debugging tools like `laravel-debugbar`.
How do I handle snapshot retention and cleanup in XHGui?
XHGui stores snapshots in its database (SQLite/MySQL by default). Use XHGui’s built-in retention settings or write a cron job to purge old data. For Docker deployments, ensure persistent volumes are configured to avoid data loss. Monitor storage usage to prevent performance degradation.
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware