Skip to content

Instantly share code, notes, and snippets.

@kiddtang
Last active October 16, 2021 08:42
Show Gist options
  • Save kiddtang/7bf8b16daf422a944749e7bfcfbee7cf to your computer and use it in GitHub Desktop.
Save kiddtang/7bf8b16daf422a944749e7bfcfbee7cf to your computer and use it in GitHub Desktop.
Xdebug Laravel Sail project in VS Code
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./docker/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
XDEBUG: '${APP_DEBUG:-false}'
XDEBUG_PORT: '${SAIL_XDEBUG_PORT:-9003}'
ARG XDEBUG
ARG XDEBUG_PORT
RUN if [ "${XDEBUG}" = 'true' ] ; then \
apt-get update \
&& apt-get install -y php-xdebug \
&& echo "[XDebug]" > /etc/php/8.0/cli/php.ini \
&& echo "zend_extension="$(find /usr/lib/php/20200930/ -name xdebug.so)" > /etc/php/8.0/cli/php.ini" \
&& echo "xdebug.mode = debug" >> /etc/php/8.0/cli/php.ini \
&& echo "xdebug.discover_client_host = true" >> /etc/php/8.0/cli/php.ini \
&& echo "xdebug.client_host = host.docker.internal" >> /etc/php/8.0/cli/php.ini \
&& echo "xdebug.client_port = ${XDEBUG_PORT}" >> /etc/php/8.0/cli/php.ini \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ;\
fi;
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Sail Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
},
"hostname": "localhost",
"ignore": ["**/vendor/**/*.php"],
"xdebugSettings": {
"max_data": 65536,
"show_hidden": 1,
"max_children": 100,
"max_depth": 3
}
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment