Dumper
Every debugging developer is a good friend with the function var_dump
, which lists all contents of any variable in
detail. Unfortunately, its output is without HTML formatting and outputs the dump into a single line of HTML code, not to mention
context escaping. It is necessary to replace the var_dump
with a more handy function. That is just what
dump()
is.
generates the output:

You can change the default light theme to dark:

You can also change the nesting depth by Debugger::$maxDepth
and displayed strings length by
Debugger::$maxLength
. Naturally, lower values accelerate Tracy rendering.
The dump()
function can display other useful information. Tracy\Dumper::LOCATION_SOURCE
adds a
tooltip with path to the file, where the function was called. Tracy\Dumper::LOCATION_LINK
adds a link to the file.
Tracy\Dumper::LOCATION_CLASS
adds a tooltip to every dumped object containing path to the file, in which the
object's class is defined. All these constants can be set in Debugger::$showLocation
variable before calling the
dump()
. You can set multiple values at once using the |
operator.
Very handy alternative to dump()
is dumpe()
(ie. dump and exit) and bdump()
. This allows
us to dump variables in Tracy Bar. This is useful, because dumps don't mess up the output and we can also add a title to
the dump.
