How to deactivate Xdebug way to dump data in Twig's {{ dump() }} in Symfony 4

人走茶凉 提交于 2020-01-03 18:39:08

问题


I am using Symfony 4 on PHP 7.1.14 with Xdebug enabled and html_errors=on.

When I use {{ dump() }} function in my twig, data printed on the screen is hard to read because of poor Xdebug formatting (ugly dump). It's also not dumping objects, which is necessary in my case (I see them as an object and can't see their properties).

I remember using this function in Symfony 3 with PHP 7.0.13 and the output was presented as the cool black area with foldable data (cool dump). All PHP options and extensions were the same.

Is there any way to force using Twig dump?


回答1:


In Symfony4, 'dump' appears to be in Flex's 'debug-pack'

composer req debug-pack



回答2:


I think for Symfony4 you have to use the composer require var-dumper package.

Symfony Docs



来源:https://stackoverflow.com/questions/49511593/how-to-deactivate-xdebug-way-to-dump-data-in-twigs-dump-in-symfony-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!