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

Laravel Xhprof Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Performance Optimization Roadmap: Accelerate delivery of high-performance features by quantifying bottlenecks (e.g., "Profiling reveals 35% of API latency stems from unoptimized Eloquent queries—allocate sprint capacity to implement caching").
  • Build vs. Buy Decision: Replace a custom profiling solution (requiring 6–12 months of dev effort and $50K+ in maintenance) with a zero-maintenance, Laravel-native package that integrates into existing workflows without disrupting productivity.
  • Non-Functional Requirements (NFRs): Enforce performance SLAs in CI/CD pipelines (e.g., "API must respond under 500ms") by failing tests on deviations, reducing runtime failures in production.
  • Developer Productivity: Reduce debugging time for slow endpoints by 90%, enabling developers to diagnose bottlenecks in minutes (e.g., "Add ?profile=1 to any route to instantly visualize wall time, memory usage, and call graphs").
  • Cost Efficiency: Eliminate $20K/year in enterprise APM tooling (e.g., New Relic) during development while maintaining full visibility into critical bottlenecks.
  • Scalable Profiling: Support CLI jobs, queues, and background tasks alongside web requests, ensuring optimizations are applied across the entire stack (e.g., "Profiling shows a CLI job processing 10K records takes 2 hours—optimize to 10 minutes").
  • Regression Prevention: Implement branch comparison workflows to catch performance regressions before they reach production (e.g., "Flame graph shows a 30% increase in wall time for /orders in the feature/payment branch—block merge until optimized").
  • Data-Driven Technical Debt Management: Shift from anecdotal tuning to evidence-based optimizations by identifying top CPU/memory consumers (e.g., "Top 3 bottlenecks: Redis serialization (25%), queue workers (20%), Eloquent hydration (15%)").

When to Consider This Package

Adopt When:

  • Your Laravel 10–13.x application has XHProf PHP extension enabled in both CLI and web (verify with php -m | grep xhprof).
  • You need targeted profiling for:
    • Slow user flows (e.g., checkout, API endpoints, CLI jobs).
    • Feature tests to enforce performance SLAs (e.g., "API must respond under 500ms").
    • Debugging memory leaks, CPU spikes, or inefficient queries.
  • You want a Laravel-native solution with minimal setup (no external services, no complex configurations).
  • Profiling needs are development/staging-focused (not production monitoring).
  • You control the PHP environment (e.g., self-hosted, Docker, or VPS) to install XHProf.
  • Your team lacks resources to build/maintain a custom profiling solution or needs rapid iteration on performance fixes.
  • You need to compare performance across branches to validate optimizations or catch regressions.

Look Elsewhere If:

  • You require enterprise APM (e.g., New Relic, Datadog) with infrastructure metrics, RUM, or distributed tracing.
  • XHProf extension is unavailable (e.g., shared hosting, legacy PHP, or restricted environments).
  • You need always-on production profiling (this package adds overhead and should be strictly gated).
  • Your production traffic is high, and you lack storage scaling (e.g., DB bloat or file system limits).
  • You prioritize real-user monitoring (RUM) or historical trend analysis.
  • Your team lacks PHP extension management (e.g., shared hosting where you cannot install xhprof).

How to Pitch It (Stakeholders)

For Executives:

"This tool directly impacts our bottom line by helping the team ship faster and maintain high performance—here’s how it delivers ROI:

  • Faster Releases: Profiling slow endpoints takes 2 minutes (just append ?profile=1 to any URL) instead of hours of trial-and-error debugging. Example: "Identified and fixed a 500ms bottleneck in the checkout flow in one sprint, reducing cart abandonment by 15%."
  • Cost Savings: Eliminate $20K/year in enterprise APM tooling during development while maintaining visibility into critical bottlenecks.
  • Data-Driven Prioritization: Pinpoint where to invest in optimizations (e.g., "30% of API latency is from unoptimized queries—allocate budget for query tuning").
  • Risk Reduction: Catch performance regressions before they reach production by comparing branches. Example: "Blocked a merge that would have degraded API response time by 30%."
  • Scalable Growth: Ensure performance doesn’t become a bottleneck as we scale. Example: "Profiling helped us optimize a CLI job that was running in 2 hours—now it completes in 10 minutes, enabling faster data processing."

For Engineering Teams:

"This package integrates seamlessly into Laravel and gives you instant visibility into performance issues—here’s how to use it effectively:

  • Profile Any Endpoint: Add ?profile=1 to any URL or enable via middleware to instantly see wall time, memory usage, and call graphs.
  • CLI Profiling: Profile Artisan commands or queues to find slow background jobs (e.g., "Our send-emails job was taking 45 minutes—profiling showed it was stuck in a loop").
  • Branch Comparisons: Compare performance between branches to catch regressions early. Example: "The feature/payment branch added 300ms to /orders—fixed before merge."
  • Test Performance SLAs: Add assertions to PHPUnit tests to fail builds if performance degrades (e.g., "API must respond under 500ms").
  • Zero Maintenance: No external services, no complex setup—just install, configure, and profile. Example: "Took 15 minutes to set up and already found a memory leak in our API."

For Product Managers:

"This tool aligns with your goals by ensuring fast, reliable, and scalable features—here’s how it supports your roadmap:

  • Prioritize Optimizations: Use profiling data to justify technical debt (e.g., "Profiling shows 40% of latency is from third-party APIs—negotiate SLA improvements").
  • Reduce Debugging Time: Developers spend less time guessing and more time fixing real issues, accelerating feature delivery.
  • Enforce Performance SLAs: Add profiling to CI/CD pipelines to ensure new features meet performance targets before release.
  • Cost-Effective Scaling: Avoid over-provisioning infrastructure by identifying and fixing bottlenecks before they impact users.
  • Data for Stakeholders: Provide evidence-based insights to executives (e.g., "Optimizations reduced API latency by 30%, improving user retention").

For Developers:

"This is the fastest way to debug performance issues in Laravel—here’s how to get started:

  1. Install in 5 minutes:
    composer require laracraft-tech/laravel-xhprof
    php artisan vendor:publish --tag=xhprof-config
    php artisan migrate
    
  2. Profile Anything:
    • Web: Append ?profile=1 to any URL.
    • CLI: Wrap your code in Xhprof::start()/stop().
    • Middleware: Enable for specific routes.
  3. Find Bottlenecks Instantly:
    • Look for spikes in wall time (e.g., slow queries, loops).
    • Check memory peaks (e.g., large payloads, serialization).
    • Analyze call trees to spot redundant function calls.
  4. Integrate into Workflows:
    • Add to PHPUnit tests to enforce SLAs.
    • Compare branches to catch regressions.
    • Profile CLI jobs and queues for background optimizations.
  5. Advanced Tips:
    • Skip noisy endpoints with skip_urls in config.
    • Use conditional profiling (e.g., only in local environment).
    • Extend storage to S3 or other backends for scalability.

Example Workflow:

"Our /api/orders endpoint was slow. I added ?profile=1, saw a 400ms spike in Order::with('items')->get(), and optimized the query. Fixed in 20 minutes—no more guessing!"

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport