Debugging & Xdebug
Turn on Xdebug for one site and step through your code in your editor, catch dump() output in Burrow, and see every request and log line as it happens.
Xdebug#
Xdebug lets you pause a request at a breakpoint and look at its variables in VS Code or PhpStorm.
Turn it on#
Open the site's General tab and tick Step debugging for this site next to Xdebug. Or, in the project folder:
burrow xdebug on # also prints the editor setup
burrow xdebug status
burrow xdebug off
Add --site shop to choose a site from anywhere.
Only that site loads Xdebug: Burrow runs its requests on a separate PHP-FPM, so your other sites stay at full speed. Every request then connects to your editor on 127.0.0.1:9003, Xdebug's usual port; there's no browser extension or trigger to set up.
VS Code#
-
Install the PHP Debug extension (by Xdebug).
-
With Xdebug on, the General tab shows a
launch.jsonunder VS Code. Press Copy launch.json and save it as.vscode/launch.jsonin the project:{ "version": "0.2.0", "configurations": [ { "name": "Listen for Xdebug (Burrow)", "type": "php", "request": "launch", "port": 9003 } ] } -
In VS Code's Run and Debug view, start Listen for Xdebug (Burrow).
-
Set a breakpoint and reload the page in your browser.
PhpStorm#
The General tab shows these steps under PhpStorm, with your site's name filled in:
- Settings → PHP → Debug: set the Xdebug port to
9003. - Settings → PHP → Servers: add a server named
shop.testwith hostshop.test, port443and debugger Xdebug. No path mappings are needed, since the files are on your computer. - Click Start Listening for PHP Debug Connections (the phone icon), set a breakpoint and reload the page.
"PHP 8.x has no Xdebug yet"#
Xdebug comes with Burrow's builds of PHP 8.2 and newer. If the switch is greyed out with this message, the site runs an older build or PHP 8.1:
- update that PHP version on the PHP page (Update to …, or
burrow php install 8.4), or - choose PHP 8.2 or newer for the site on its General tab.
See PHP versions.
Dumps#
Instead of dump() and dd() output ending up in the middle of your page (or getting lost in a queue job), Burrow can collect it. Open the site's Dumps tab and press Capture dumps.
While capturing, dumps from pages, queue jobs, scheduled tasks and the Artisan tab appear in the tab with the file, line and request they came from. Clear empties the list; Stop capturing shows dumps in the page again.
From a terminal:
burrow dumps start shop
burrow dumps log shop # the captured dumps
burrow dumps stop shop
Requests and logs#
- The site's Requests tab lists every request live, with its status code and how long it took. Slow requests (500 ms or more) are highlighted and collected under Slowest, and Errors (4xx/5xx) shows only the failures. See Requests.
- The Logs tab shows the latest lines of
storage/logs/laravel.log, refreshed live, with errors and warnings in colour and a filter box. - The Health tab finds the usual setup problems (a missing
APP_KEY, pending migrations, a stopped database) and fixes them in one click. See Health.