Skip to content

Instantly share code, notes, and snippets.

@ssaki
Created April 19, 2017 09:55
Show Gist options
  • Save ssaki/4457419b06f10c26efb4e12812eb93e7 to your computer and use it in GitHub Desktop.
Save ssaki/4457419b06f10c26efb4e12812eb93e7 to your computer and use it in GitHub Desktop.
XDebug/PHPStorm "bookmarklets" for CLI
# Couple of functions to set/clean the necessary ENV variables and enable debugging with PHPStorm
# in the same manner as debug bookmaklets for web debugging
#
# The server name argument is name of the server in PHPStorm's "Run/Debug configurations" settings screen
# ( "Run" > "Edit configurations" > "PHP Web Applications" )
#
xdebug_on()
{
if [ "$1" == "" ]; then
echo -e "\nPlease provide the docker host name as argument\n\n"
else
export XDEBUG_CONFIG="idekey=PHPSTORM"
export PHP_IDE_CONFIG="serverName=$1"
echo -e "\nXDebug is activated for $1\n\n"
fi
}
xdebug_off()
{
unset XDEBUG_CONFIG
unset PHP_IDE_CONFIG
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment