a Symfony Product

The PHP micro-framework
based on the Symfony Components

Silex is in maintenance mode. Ends of life is set to June 2018.
Use Symfony 4 instead. Read more on Symfony's blog.
You are reading the documentation for Silex 2.0. Switch to the documentation for Silex 1.3.

Questions & Feedback


Creative Commons License Silex documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.

Var Dumper

The VarDumperServiceProvider provides a mechanism that allows exploring then dumping any PHP variable.


  • var_dumper.dump_destination: A stream URL where dumps should be written to (defaults to null).


  • n/a


$app->register(new Silex\Provider\VarDumperServiceProvider());


Add the Symfony VarDumper Component as a dependency:

composer require symfony/var-dumper


Adding the VarDumper component as a Composer dependency gives you access to the dump() PHP function anywhere in your code.

If you are using Twig, it also provides a dump() Twig function and a dump Twig tag.

The VarDumperServiceProvider is also useful when used with the Silex WebProfiler as the dumps are made available in the web debug toolbar and in the web profiler.

Website powered by Symfony and Twig, deployed on
The Silex logo is © 2010-2018 Symfony