VarDumper Component of Symfony

In this post, we’re going to review Symfony VarDumper Component.

Whenever we want to dump information about variable, we use either var_dump or print_r.
Both functions have a different functionality check it out here.

The VarDumper component provides mechanisms for extracting the state out of any PHP variables. Built on top, it provides a better dump() function that you can use instead of var_dump.

The main feature of this component is HTML or colored command line output and repeated occurrences of the same object/array/resource won’t appear again.

Installation

Example

Output

1) HTML Output

vardumper

2) Console Output

console dump

That’s it.

Leave a Comment