The VarDumperServiceProvider provides a mechanism that allows exploring then dumping any PHP variable.
null
).1 | $app->register(new Silex\Provider\VarDumperServiceProvider());
|
Note
Add the Symfony VarDumper Component as a dependency:
1 | 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.