perftools/php-profiler
A low-overhead PHP profiler extension plus client library for collecting and exporting performance data. Capture CPU and memory usage for scripts and web requests, then send profiles to compatible backends for analysis and visualization.
perftools/php-profiler package leverages XHGUI’s data collector to provide low-overhead profiling for PHP applications, making it ideal for performance-critical Laravel applications (e.g., APIs, batch jobs, or high-traffic endpoints). It aligns well with Laravel’s event-driven architecture (e.g., profiling middleware, queue workers, or scheduled tasks).telescope, horizon for queues) but lacks native Laravel-specific integrations (e.g., no out-of-the-box support for Laravel’s service container or Eloquent events).Kernel.php) or service providers to profile HTTP requests. Custom instrumentation requires manual setup (e.g., decorating services).Illuminate\Queue\Events\JobProcessed).laravel.log or telescope events).cache:clear) or queue retries?ext-xhprof, ocramius/profiler) with better Laravel support?telescope) or those needing high-level business transaction tracing (consider laravel-debugbar or APM tools instead).composer require perftools/php-profiler
// app/Http/Kernel.php
protected $middleware = [
\App\Http\Middleware\ProfileRequests::class, // Custom wrapper
];
Illuminate\Queue\Worker or use events (JobProcessed) to profile jobs.profile.app.com) or integrate with existing dashboards.array_unpack)..env to toggle profiling:
PROFILING_ENABLED=true
PROFILING_OUTPUT_DIR=/tmp/profiles
finished event for HTTP, JobProcessed for queues).laravel.log and profile data./tmp/profiles or XHGUI UI).app()->environment('local')).Spatie\FeatureFlags).DB::enableQueryLog()).- name: Profile Application
if: github.ref == 'refs/heads/main'
run: php artisan profile:run --output=/tmp/profiles
How can I help you explore Laravel packages today?