When you start tinkering with a module or a theme in Drupal, eventually you’ll need to print a variable to see what’s inside.
Now in PHP you have
print_r but these functions aren’t the easiest to work with. When used they print the variable fully expanded, making it hard to filter or find anything.
In the Devel module for Drupal 7, you have the
dsm which printed variables using the Krumo library. For Drupal 8, however, this library has been replaced with a more modern and maintained library called Kint.
In the latest tutorial over at WebWash, learn how to print variables within Php and the Twig template using Kint.