wolfulus / xdebug-toggle
XDebug Toggle.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/wolfulus/xdebug-toggle
Requires
- php: >=7.2
- webmozart/path-util: ^2.3
Requires (Dev)
- cedx/coveralls: ^11.2
- friendsofphp/php-cs-fixer: ^2.16
- nunomaduro/phpinsights: ^1.14
- phpmetrics/phpmetrics: ^2.6
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12
- phpstan/phpstan-phpunit: ^0.12
- phpstan/phpstan-strict-rules: ^0.12
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2025-10-13 03:20:30 UTC
README
Toggles PHP XDebug extensions.
How it works?
This package detects where your php.ini file is located and creates two copies on the same folder with -xdebug-enabled
and -xdebug-disabled suffix to them.
Any changes made to those files will reset because it keeps those files in sync whenever you run the commands.
In order to enable/disable XDebug, the package tries to identify the library name and location, like xdebug.so and
xdebug-2.9.4-7.4-vc15-nts-x86_64) on the original php.ini file. You MUST have at least a line containing
zend_extension=...xdebug on your original php.ini file in order for it to work, even if it's commented out with a ;.
The xdebug command is just a wrapper over php executable that disables the original php.ini loading and loads one of
the copies instead.
By running xdebug [...php args] you're running a PHP instance with XDebug enabled. The xdebug accepts a --disable flag
immediately after the xdebug command if you want to run with it disabled. There's also two additional commands
xdebug-enabled and xdebug-disabled that does the exact same thing but without the flags.
Installation
composer global require wolfulus/xdebug-toggle
Usage
xdebug file.phpxdebug --disable file.phpxdebug-enabled file.phpxdebug-disabled file.phpxdebug -r "echo extension_loaded('xdebug') ? 'loaded' : 'not loaded';"xdebug --disable -r "echo extension_loaded('xdebug') ? 'loaded' : 'not loaded';"xdebug --help
License
MIT