New in Symfony 2.7: VarDumper improvements
Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.
The VarDumper component was introduced in Symfony 2.6 to provide a better
debugging experience. This component includes a
dump() function which is a
much better alternative to the regular PHP
In Symfony 2.7 we made the
dump() function easier to use and we also improved
the dumping of complex variables such as PHP reflection classes.
In Symfony 2.6, when dumping a deeply nested variable, you must click on each node arrow to reveal the contents of the nested nodes:
Symfony 2.7 removes this hassle by adding recursive toggle support. Just press
Ctrl key before clicking on any arrow and you'll toggle all the nested
The VarDumper component uses casters to transform the objects and resources into the array-based data representation used to display the variable contents. Symfony 2.7 includes new casters to improve the debugging of Reflection classes, MongoCursor objects, XML parser resources and AMQP resources.
For example, when you dump a PHP class reflection in Symfony 2.6, you get the string representation of that reflection:
In Symfony 2.7, thanks to the new specialized caster for PHP reflection classes, you'll see a much better dump:
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.