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.
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:
PhpConfig helpers to avoid unintended Xdebug loadingKey questions:
xdebug.mode=off but other Xdebug features are enabled via ini?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:
composer.json: composer require composer/xdebug-handleruse Composer\XdebugHandler\XdebugHandler;
$xdebug = new XdebugHandler('myapp');
$xdebug->check();
unset($xdebug);
// Rest of application code
PhpConfig helpers before spawning new processes.Compatibility:
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.
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:
How can I help you explore Laravel packages today?