Xdebug for your rescue in Drupal 8 debugging

ameymudras
Overview

If you have worked with D8 already, you are probably aware that the oldschool "dsm all the things" approach no longer works, primarily due to the size of the structures, objects and whatnot being dumped. If you haven't, well, you are aware now :)

So let's look at the some of the options available:

  • use print_r(); die;
  • enable devel and kint
  • twig dump

One approach that just stands out is making use of xdebug for debugging. Xdebug allows you to follow program execution and its effects, to observe the call stack of functions, and review the contents of variables at any point during the execution.

Here is a link that provides an overview of the increasing popularity of xdebug over kint: https://php.libhunt.com/project/xdebug/vs/kint.

What this session will cover
  • Overview of why to use xdebug
  • Configuring xdebug for drupal 8
  • Configuring your IDE with xdebug
  • Remote debugging
  • Breakpoints and stack trace with example
  • Using xdebug with phpstorm

Session Track

Coding and Development

Experience Level

Intermediate

Drupal Version