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

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

Note

Add the Symfony VarDumper Component as a dependency:

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 Mascot WebProfiler as the dumps are made available in the web debug toolbar and in the web profiler.