DamJ
DamJ

Reputation: 43

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

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?

ugly dump

cool dump

Upvotes: 4

Views: 298

Answers (2)

l.g.karolos
l.g.karolos

Reputation: 1142

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

Symfony Docs

Upvotes: 1

Alister Bulman
Alister Bulman

Reputation: 35149

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

composer req debug-pack

Upvotes: 4

Related Questions