From eac5218d758df7e299878fbf14cdbd28b4af1242 Mon Sep 17 00:00:00 2001 From: Robert Brian Gottier Date: Tue, 21 Aug 2018 10:14:20 -0700 Subject: [PATCH 1/2] Explain dump server usage outside of Symfony Took hours for me to figure out how to use the dump server outside of Symfony, because there is no mention that it can be done, and one must use the ServerDumper class to make it work. --- components/var_dumper.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/var_dumper.rst b/components/var_dumper.rst index 24c25e25870..1822f446e64 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -119,6 +119,20 @@ Inside a Symfony application, the output of the dump server is configured with the :ref:`dump_destination option ` of the ``debug`` package. +Outside a Symfony application, one is required to 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->dump($cloner->cloneVar($var)); + }); + DebugBundle and Twig Integration -------------------------------- From d3604523bc4091d80d4c306c3c7b234089b214c2 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 28 Aug 2018 15:22:16 -0400 Subject: [PATCH 2/2] minor language tweak --- components/var_dumper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/var_dumper.rst b/components/var_dumper.rst index 1822f446e64..8b65df82e6d 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -119,7 +119,7 @@ Inside a Symfony application, the output of the dump server is configured with the :ref:`dump_destination option ` of the ``debug`` package. -Outside a Symfony application, one is required to use the ServerDumper class: +Outside a Symfony application, use the ``ServerDumper`` class: require __DIR__.'/vendor/autoload.php';