diff --git a/components/var_dumper.rst b/components/var_dumper.rst index f8f279929c5..16ef2714b8c 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -64,6 +64,15 @@ current PHP SAPI: mechanism; * On other SAPIs, dumps are written as HTML in the regular output. +.. tip:: + + You can also select the output format explicitly defining the + ``VAR_DUMPER_FORMAT`` environment variable and setting its value to either + ``html`` or ``cli``. + + .. versionadded:: 4.2 + The ``VAR_DUMPER_FORMAT`` env var was introduced in Symfony 4.2. + .. note:: If you want to catch the dump output as a string, please read the @@ -122,14 +131,14 @@ the :ref:`dump_destination option ` of the Outside a Symfony application, use the ``ServerDumper`` class:: require __DIR__.'/vendor/autoload.php'; - + use Symfony\Component\VarDumper\VarDumper; use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\ServerDumper; - + VarDumper::setHandler(function ($var) { $cloner = new VarCloner(); - $dumper = new ServerDumper('tcp://127.0.0.1:9912'); + $dumper = new ServerDumper('tcp://127.0.0.1:9912'); $dumper->dump($cloner->cloneVar($var)); });