8000 [VarDumper] Document the VAR_DUMPER_FORMAT=server format · symfony/symfony-docs@5cb0e36 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5cb0e36

Browse files
ogizanagijaviereguiluz
authored andcommitted
[VarDumper] Document the VAR_DUMPER_FORMAT=server format
1 parent df3759b commit 5cb0e36

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

components/var_dumper.rst

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ current PHP SAPI:
6666

6767
You can also select the output format explicitly defining the
6868
``VAR_DUMPER_FORMAT`` environment variable and setting its value to either
69-
``html`` or ``cli``.
69+
``html``, ``cli`` or :ref:`server <var-dumper-dump-server-format>`.
7070

7171
.. note::
7272

@@ -186,6 +186,39 @@ Then you can use the following command to start a server out-of-the-box:
186186
$ ./vendor/bin/var-dump-server
187187
[OK] Server listening on tcp://127.0.0.1:9912
188188
189+
.. _var-dumper-dump-server-format:
190+
191+
Debug any project with the server format
192+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193+
194+
There is a way to force the ``VarDumper`` to dump to a server, without the need to configure anything in your
195+
application: by using the ``VAR_DUMPER_FORMAT=server`` environment variable.
196+
It is especially useful to debug any project (as soon as the VarDumper component is installed),
197+
without altering its code by:
198+
199+
* starting a server:
200+
201+
.. code-block:: terminal
202+
203+
$ ./vendor/bin/var-dump-server
204+
205+
* running your code with the ``VAR_DUMPER_FORMAT=server`` env variable. For instance, for a CLI command:
206+
207+
.. code-block:: terminal
208+
209+
$ VAR_DUMPER_FORMAT=server [your-cli-command]
210+
211+
.. tip::
212+
213+
If your project loads environment variables from a dotenv file, you can set the ``VAR_DUMPER_FORMAT=server``
214+
environment variable in there as well.
215+
216+
.. note::
217+
218+
The host used to contact the server when using the ``server`` format is the one configured by the
219+
``VAR_DUMPER_SERVER`` var or defaults to ``127.0.0.1:9912``.
220+
But you can configure the host through the ``VAR_DUMPER_FORMAT=tcp://127.0.0.1:1234`` environment variable as well.
221+
189222
DebugBundle and Twig Integration
190223
--------------------------------
191224

0 commit comments

Comments
 (0)
0