- create and start containers
$ docker-compose up -d
- create a new Laravel project
$ docker exec -it docker_laravel_php bash $ composer create-project laravel/laravel .
- start local development server
accsess local development server http://localhost:80
$ php artisan serve --host=0.0.0.0 --port=80
-
install PHP Debug
-
setting
.vscode/launch.json
/.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003, "pathMappings": { "/var/www/html/": "${workspaceRoot}/src/" } }, ] }
Referens
launch.json attribute
https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes
about pathMappings
https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug
/php.ini
https://xdebug.org/docs/all_settings
- Ctrl+Shift+D
- ▶︎(RUN) 「Listen for Xdebug」 selection
- Set a breakpoint on any line
- F5 or ▶︎ click to debag start