diff --git a/docker-compose.yml b/docker-compose.yml index 91747c15..cf7b804e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,6 +47,8 @@ services: extra_hosts: # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) - "dockerhost:10.0.75.1" + ports: + - "22:22" environment: # IMPORTANT: Set the Remote Interpreter entry matching name to `laravel` - PHP_IDE_CONFIG="serverName=laravel" diff --git a/xdebugPhpFpm b/xdebugPhpFpm index 1a343ce5..d1e75137 100644 --- a/xdebugPhpFpm +++ b/xdebugPhpFpm @@ -6,12 +6,21 @@ # Grab full name of php-fpm container PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1) + +# Grab OS type +if [[ "$(uname)" == "Darwin" ]]; then + OS_TYPE="OSX" +else + OS_TYPE=$(expr substr $(uname -s) 1 5) +fi + + xdebug_status () { echo 'xDebug status' # If running on Windows, need to prepend with winpty :( - if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then + if [[ $OS_TYPE == "MINGW" ]]; then winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' else @@ -20,6 +29,7 @@ xdebug_status () } + xdebug_start () { echo 'Start xDebug' @@ -30,7 +40,7 @@ xdebug_start () # If running on Windows, need to prepend with winpty :( - if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then + if [[ $OS_TYPE == "MINGW" ]]; then winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" docker restart $PHP_FPM_CONTAINER winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' @@ -40,9 +50,9 @@ xdebug_start () docker restart $PHP_FPM_CONTAINER docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' fi - } + xdebug_stop () { echo 'Stop xDebug' @@ -52,7 +62,7 @@ xdebug_stop () # If running on Windows, need to prepend with winpty :( - if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then + if [[ $OS_TYPE == "MINGW" ]]; then # This is the equivalent of: # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593