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

Xdebug Handler Laravel Package

composer/xdebug-handler

Restart PHP CLI processes without loading Xdebug (unless xdebug.mode=off), avoiding slowdowns in tools like Composer. Creates a temporary ini with Xdebug commented out and relaunches the command, with env vars to allow Xdebug or inspect original ini paths.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: This package is purpose-built for CLI process management, making it ideal for PHP command-line applications. Its architecture is lightweight and decoupled from frameworks, relying solely on environment variables and temporary ini files to handle Xdebug restarts. This fits well in any PHP CLI context where performance optimization during development is needed, such as Laravel Artisan commands or standalone scripts.

Integration feasibility: High feasibility with minimal code changes. Requires only composer require and a single check() call in the main script entrypoint. The fluent API and clear examples in the README allow for quick adoption. No framework-specific hooks are needed, making it universally applicable.

Technical risk: Low overall risk for standard use cases, but notable edge cases exist:

  • Permission issues with temporary ini file creation (handled via warnings but could cause restart failures)
  • Windows-specific signal handling limitations prior to PHP 7.4
  • Potential conflicts with custom ini settings or extensions loaded via command-line flags
  • Sub-process management requires careful use of PhpConfig helpers to avoid unintended Xdebug loading

Key questions:

  1. How does the package handle nested restarts (e.g., when a restarted process spawns another CLI command)?
  2. What is the behavior when xdebug.mode=off but other Xdebug features are enabled via ini?
  3. How does it interact with opcode caches like OPcache during restarts?
  4. Are there known issues with PHP 8.2+ or specific Xdebug 3 configurations?

Integration Approach

Stack fit: Perfect for any PHP CLI stack. Works seamlessly with Laravel (Artisan commands), Symfony Console, or raw PHP scripts. No framework dependencies – ideal for projects using Composer-based tooling. The package's environment-variable-based approach ensures compatibility with Docker, CI/CD pipelines, and cloud environments.

Migration path:

  1. Add to composer.json: composer require composer/xdebug-handler
  2. Wrap main script entrypoint with:
    use Composer\XdebugHandler\XdebugHandler;
    $xdebug = new XdebugHandler('myapp');
    $xdebug->check();
    unset($xdebug);
    // Rest of application code
    
  3. For advanced cases (sub-processes), integrate PhpConfig helpers before spawning new processes.
  4. Replace any existing Xdebug-avoidance logic with this package.

Compatibility:

  • PHP 7.2.5+ (v3) / 5.3.2+ (v2 LTS)
  • Xdebug 2.x and 3.x
  • Windows (with PHP 7.4+ for full signal handling)
  • All major Linux/macOS distributions
  • Confirmed compatible with Composer 2.2+ and modern PHP frameworks

Sequencing: Must be the first executable statement in the CLI script. Call check() before any application logic or autoloading to prevent accidental Xdebug initialization. For Laravel, place this at the very top of artisan or command entrypoints. Unset the handler immediately after check() to avoid memory leaks.

Operational Impact

Maintenance: Very low. The package has a stable API with infrequent updates (last release 2024-05-06). No external dependencies beyond PHP core. MIT license removes licensing overhead. Minimal maintenance required beyond standard dependency updates.

Support: Strong documentation with detailed examples and troubleshooting guides. GitHub issues are actively monitored (based on recent release activity). For enterprise use, the small codebase (≈500 LOC) allows internal debugging without heavy reliance on external support. Community support is adequate for common use cases.

Scaling:

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