I have read posts like visual studio code PHP debugging not working and XDebug not working in VScode for php debugging but can't manage to make this work properly in my Laravel projects.
I'm using XDebug V3 and it works on single php files but not on laravel projects. I use VSCode.
My configuration:
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"stopOnEntry": true,
"log": true,
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000,
"pathMappings": {
"C:/xampp/htdocs/myLaravelProject": "${workspaceFolder}"
}
}
]
}
php.ini
[XDebug]
zend_extension = xdebug
xdebug.mode = debug
xdebug.start_with_request = trigger
xdebug.remote_port = 9000
xdebug.client_port = 9000
Works: single file index.php
<?php
$i = 1 + 4;
echo $i; // Breakpoint here works
Doesn't work: Laravel Project/routes/web.php
<?php
Route::get('/test-breakpoint', function()
{
$i = 1 + 4;
echo $i; // Breakpoint here doesn't work
});