Reputation: 2406
I want to train myself to use Drupal 8 (Im from drupal 7 =) ). So, I learned some symfony2 basics. Now, I would like know if there is a good way about the code debugging, I mean : Before with Drupal 7, I used the devel module for show the content of data (very usefull !). I try this module for drupal 8 but the dpm function seems not work in the class context.
Bu example, I use this code for alter some route :
<?php
namespace...
use...
...
class RouteSubscriber extends RouteSubscriberBase{
public function alterRoutes(RouteCollection $collection){
// What is the best way for display the $collection array ? like a dpm ?
dpm($collection); // doen't work, nothing appears in any page
}
Thanks =)
Upvotes: 1
Views: 1876
Reputation: 11
If you're used to using the Devel debug functions like dsm()
and dpm()
, you would feel right at home using Devel Kint.
Just enable the module Devel Kint and use it in modules or theme with kint($variables)
.
I would also look into using Xdebug and setting break points to debug at a deeper level.
Upvotes: 1
Reputation: 123
Use debug()
in Drupal 8. debug()
will print the content of the variables as messages on the site. Alternatively, you can use a debugging tool like xdebug to examine your variables.
Upvotes: 1