PHP Debug in Visual Studio Code breaks on every exception
I was looking for another answer for this question
I was having breakpoints in my Composer dependencies, which turned debugging really annoying.
For anyone having the same issue, you can set the property ignore
in the launch.json
file, with an array of glob patterns for the PHP Debug extension to ignore.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"ignore": [
"**/vendor/**/*"
]
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000,
"ignore": [
"**/vendor/**/*"
]
}
]
}
I've just found the answer myself (feeling a little stupid now!).
In Visual Studio Code, go to View->Debug, then uncheck the 'Everything' button in the Breakpoints section. That option will automatically break on PHP Notices, Warnings and Exceptions.
follow these steps as image below then
check and unchecked what you want