Skip to content

Explain dump server usage outside of Symfony #10204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions components/var_dumper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ Inside a Symfony application, the output of the dump server is configured with
the :ref:`dump_destination option <configuration-debug-dump_destination>` of the
``debug`` package.

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->dump($cloner->cloneVar($var));
});

DebugBundle and Twig Integration
--------------------------------

Expand Down