A script that generates an executable which will toggle XDebug on/off on your local development environment.
$> curl -o install_xdebug_toggle.sh https://gist.githubusercontent.com/jimdelois/245c50bd7d31baa774c07644a39f30f9/raw/install_xdebug_toggle.sh
$> chmod +x install_xdebug_toggle.sh
The script requires the location of an XDebug INI file to verify that it can install the toggler. If you're installing this toggler, then you probably already have the XDebug extension installed. In this case, you can find the location of the XDebug INI file by running:
$> php -i | grep xdebug.ini
/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
Provide this location as the first argument to the script. An OPTIONAL second argument is the path to which you'd like the toggler executable
installed. By default, this is /usr/local/bin/xdebug
. E.g.,
$> ./install_xdebug_toggler.sh /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
Writing toggle script at /usr/local/bin/xdebug...
Updating execute permissions on /usr/local/bin/xdebug...
Done.
Now you can invoke /usr/local/bin/xdebug
(or the custom script location if you provided one) to toggle XDebug on/off accordingly:
$> php -v
PHP 7.0.9 (cli) (built: Jul 21 2016 14:50:53) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
$> xdebug off
Disabling XDebug Extension...
Done.
$> php -v
PHP 7.0.9 (cli) (built: Jul 21 2016 14:50:53) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
$> xdebug on
Enabling XDebug Extension...
Done.
$> php -v
PHP 7.0.9 (cli) (built: Jul 21 2016 14:50:53) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
Now, you can enjoy lightning fast unit tests and composer updates again!