Session

Debugging Drupal with Xdebug

Xdebug is a PHP extension that can massively improve your debugging experience and speed – for both backend and frontend developers. Conversely, it can also drag down your php speed to a crawl, so you want to configure it to be a simple toggled – and only enable when you are using it. Xdebug works with most IDEs but I will be specifically showcasing usage with PHPStorm & VSCode. Debugging with Xdebug for many things is neither better nor worse than any other method such as var_dump(), Drupal::logger() statements etc.

Many developers find that Xdebug is faster but the reality is, breakpoints are just another tool. Xdebug usage is unrelated to seniority or development expertise. There are cases that Xdebug really excels compared to other options – such as building migrations, or other processes that run through the same code path a lot of times with slightly different variables.

Additionally, Xdebug can debug twig and let you explore available variables without worrying about memory. This use case is also often a significant speed improvement over kint() or other variable dumping methods that may show incomplete data to get around memory limits.
Xdebug has lots of functionality beyond breakpoints and variable exploration, but one I particularly like is using it like drush php`but in the middle of requests with the current variables available.

After basic installation/configuration, we will debug a spreadsheet to Drupal migration for a bit of real world usage.

Nick Dickinson-Wilde

Backend Drupal Manager - Taoti Creative

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top