-
sail artisan sail:publishを実行してDockerfileを出す。 -
Dockerfileにapt-get install -y php-xdebugを差し込む。 -
php.iniに下記追加
[XDebug]
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = host.docker.internal
-
sail build --no-cacheを実行。 - VS Codeに 拡張機能
PHP Debugを入れる。 -
.vscode/launch.jsonに下記設定を追加。
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"stopOnEntry": true,
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
},
"hostname": "localhost",
"xdebugSettings": {
"max_data": 65535,
"show_hidden": 1,
"max_children": 100,
"max_depth": 5
}
}
- VSCodeにてデバッグ開始。
終わり。