Skip to content

Commit 7b26e44

Browse files
committed
Document new environment variables and display options
1 parent b06a83a commit 7b26e44

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

components/var_dumper/advanced.rst

+21-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ Dumpers
9797

9898
A dumper is responsible for outputting a string representation of a PHP variable,
9999
using a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object as input.
100-
The destination and the formatting of this output vary with dumpers.
100+
The destination and the formatting of this output vary with dumpers and are
101+
influenced by two environment variables:
102+
If ``DUMP_STRING_LENGTH`` is set, then
103+
the length of a string is displayed next to its content.
104+
If ``DUMP_LIGHT_ARRAY`` is set,
105+
then arrays are not displayed completely.
101106

102107
This component comes with an :class:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper`
103108
for HTML output and a :class:`Symfony\\Component\\VarDumper\\Dumper\\CliDumper`
@@ -181,6 +186,21 @@ method. They also typically implement the
181186
them from re-implementing the logic required to walk through a
182187
:class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object's internal structure.
183188

189+
The HTMLDumper limits string length and nesting depth of the output.
190+
These options can be overriden by providing a third parameter when calling ``dump``::
191+
192+
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
193+
194+
$output = fopen('php://memory', 'r+b');
195+
196+
$dumper = new HtmlDumper();
197+
$dumper->dump($var, $output, array(
198+
'maxDepth' => 1,
199+
'maxStringLength' => 160
200+
));
201+
202+
// Limit nesting to 1 level and string length to 160 characters (default)
203+
184204
Casters
185205
-------
186206

0 commit comments

Comments
 (0)