in a former post i give a solution to make var_dump in twig, the main idea is set twig into debug mode and debug a variable, but Symfony2 or such kind of framework make it impossible, the circle of reference make the dump infinitive. So we need to don in another way: First , we need to create a service which can be called by a twig file, the tutorial can see here : symfony2 offical service creatation for twig extension in your service.xml and then : /** * TVarDumper class. * * TVarDumper is intended to replace the buggy PHP function var_dump and print_r. * It can correctly identify the recursively referenced objects in a complex * object structure. It also has a recursive depth control to avoid indefinite * recursive display of some peculiar variables. * * TVarDumper can be used as follows, * * echo TVarDumper::dump($var); * * * @author Qiang Xue qiang.xue@gmail.com * @version $Id$ * @package System.Util * @since 3.0 * @modifi...