Skip to content

Setup Xdebug

ucan-lab edited this page Jul 5, 2022 · 1 revision

Build app container

$ echo APP_BUILD_TARGET=development-xdebug > .env
$ docker compose build app

Re generate container

$ docker compose down
$ docker compose up -d

Check Xdebug installed

$ docker compose exec app php -v
PHP 8.1.7 (cli) (built: Jun 23 2022 07:57:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.7, Copyright (c) Zend Technologies
    
    with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
$ docker compose exec app php artisan -V
Laravel Framework 9.19.0

PhpStorm Settings

Preferences > PHP

Add CLI Interpreter

ScreenShot 2022-07-05 21 39 42 ScreenShot 2022-07-05 21 39 47

Preferences > PHP > Servers > +

ScreenShot 2022-07-05 21 42 30

Name: docker-laravel Host: localhost Port: 9003 Debugger: XDebug Use path mappings: ✅

Run > Edit Configrations...

ScreenShot 2022-07-05 21 54 10 ScreenShot 2022-07-05 21 44 49

Name: docker-laravel Filter debug connection by IDE key: ✅ Server: docker-laravel IDE key: PHPSTORM

Install Browser toolbar or bookmarklets

https://www.jetbrains.com/help/phpstorm/2022.1/browser-debugging-extensions.html?utm_source=product&utm_medium=link&utm_campaign=PS&utm_content=2022.1