laracraft-tech/laravel-xhprof
Integrate XHProf profiling into your Laravel app to measure request performance, capture CPU/memory metrics, and analyze call graphs. Includes middleware/collectors to enable profiling per route or environment and store runs for later review.
Storage) enables future-proofing for custom integrations (e.g., S3, Elasticsearch).XHPROF_SAMPLE_RATE (e.g., sample every 100µs).skip_urls) to avoid profiling non-critical routes.local or admin users).composer require, vendor:publish, migrate) and minimal configuration, reducing onboarding time. The package handles:
xhprof availability check)./xhprof for visualization).local environment./health or /api/webhooks via skip_urls./api/orders).Xhprof::start()/stop()), but requires manual instrumentation. This is feasible for critical jobs (e.g., php artisan queue:work --profile) but may not scale for all background tasks.xhprof_runs table) but supports file storage. Later versions address blob size limitations (e.g., LONGTEXT for MySQL). Risk: Schema migrations may be needed if upgrading from older versions.xhprof PHP extension must be installed and enabled in all target environments. Mitigation:
README/CONTRIBUTING.md.xhprof is missing).storage/xhprof).php artisan xhprof:prune --days=7).Storage interface.app/Http/Kernel.php.XhprofMiddleware::shouldRunEarly()).skip_urls uses literal substring matching, which may miss routes due to case sensitivity. Mitigation:
Xhprof::profile() helper for common use cases (e.g., queues).xhprof extension available in all CI/CD environments (e.g., GitHub Actions, self-hosted runners)? If not, how will you enforce extension requirements?local or for admin users (?profile=1)./xhprof) be authenticated or rate-limited? The package does not include this by default.skip_urls, sample rate).xhprof (and optionally xhguards for function-level profiling). Compatibility:
LONGTEXT for MySQL.xhprof_runs table).Storage interface (e.g., S3, Elasticsearch).xhprof extension is available (php -m | grep xhprof).composer require laracraft-tech/laravel-xhprof
php artisan vendor:publish --tag=xhprof-config
php artisan migrate
.env (e.g., XHPROF_STORAGE=file).config/xhprof.php:
'skip_urls' => [
'health', // Exclude /health
'webhooks', // Exclude /api/webhooks
],
'sample_rate' => 100000, // 100µs sample rate
'storage' => [
'driver' => 'file',
'path' => storage_path('xhprof'),
],
app/Http/Kernel.php (ensure it runs early):
protected $middleware = [
\LaracraftTech\Xhprof\Middleware\ProfileRequests::class,
// ...
];
How can I help you explore Laravel packages today?