Symfony2: debug controller variables

How to quickly access and view the variables that are used in the controller? I use xdebug, but it is often too much to see what is inside the object when passing through the controller.

+4
source share
1 answer

You can get the variables defined in the current scope using the get_defined_vars () method and register it using the Monolog library, for example,

  $this->container->get('logger')->info('Local variables', get_defined_vars()); 

I would recommend installing the FirePHP extension in Firefox, because in dev mode FirePHP handler automatically turns on so you can see informational messages in the firebug console. For more information about registering the journal of this cookbook entry .

+7
source

Source: https://habr.com/ru/post/1414032/


All Articles