a SensioLabs Product

The PHP micro-framework
based on the Symfony Components

You are reading the documentation for Silex 2.0. Switch to the documentation for Silex 1.3.

Questions & Feedback

License

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.

Parameters

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

Services

  • n/a

Registering

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

Note

Add the Symfony VarDumper Component as a dependency:

1
composer require symfony/var-dumper

Usage

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-2017 SensioLabs