|
2 | 2 | single: VarDumper
|
3 | 3 | single: Components; VarDumper
|
4 | 4 |
|
5 |
| -The VarDumper Component |
6 |
| -======================= |
7 |
| - |
8 |
| - The VarDumper component provides mechanisms for walking through any |
9 |
| - arbitrary PHP variable. Built on top, it provides a better ``dump()`` |
10 |
| - function that you can use instead of :phpfunction:`var_dump`. |
11 |
| - |
12 |
| -.. versionadded:: 2.6 |
13 |
| - The VarDumper component was introduced in Symfony 2.6. |
14 |
| - |
15 |
| -Installation |
16 |
| ------------- |
17 |
| - |
18 |
| -You can install the component in 2 different ways: |
19 |
| - |
20 |
| -- :doc:`Install it via Composer </components/using_components>` (``symfony/var-dumper`` on `Packagist`_); |
21 |
| -- Use the official Git repository (https://github.com/symfony/var-dumper). |
22 |
| - |
23 |
| -The dump() function |
24 |
| -------------------- |
25 |
| - |
26 |
| -The VarDumper component creates a global ``dump()`` function that is |
27 |
| -configured out of the box: HTML or CLI output is automatically selected based |
28 |
| -on the current PHP SAPI. |
29 |
| - |
30 |
| -The advantages of this function are: |
31 |
| - |
32 |
| -- per object and resource types specialized view to e.g. filter out |
33 |
| - Doctrine internals while dumping a single proxy entity, or get more |
34 |
| - insight on opened files with :phpfunction:`stream_get_meta_data()`. |
35 |
| -- configurable output formats: HTML or colored command line output. |
36 |
| -- ability to dump internal references, either soft ones (objects or |
37 |
| - resources) or hard ones (``=&`` on arrays or objects properties). |
38 |
| - Repeated occurrences of the same object/array/resource won't appear |
39 |
| - again and again anymore. Moreover, you'll be able to inspect the |
40 |
| - reference structure of your data. |
41 |
| -- ability to operate in the context of an output buffering handler. |
42 |
| - |
43 |
| -``dump()`` is just a thin wrapper for |
44 |
| -:method:`VarDumper::dump() <Symfony\\Component\\VarDumper\\VarDumper::dump>` |
45 |
| -so can you also use it directly. |
46 |
| -You can change the behavior of this function by calling |
47 |
| -:method:`VarDumper::setHandler($callable) <Symfony\\Component\\VarDumper\\VarDumper::setHandler>`: |
48 |
| -calls to ``dump()`` will then be forwarded to ``$callable``, given as first argument. |
49 |
| - |
50 |
| -Advanced Usage |
51 |
| --------------- |
| 5 | +Advanced Usage of the VarDumper Component |
| 6 | +========================================= |
52 | 7 |
|
53 | 8 | Cloners
|
54 | 9 | ~~~~~~~
|
@@ -201,5 +156,3 @@ method. They also typically implement the
|
201 | 156 | :class:`Symfony\\Component\\VarDumper\\Cloner\\DumperInterface` that frees
|
202 | 157 | them from re-implementing the logic required to walk through a
|
203 | 158 | :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object's internal structure.
|
204 |
| - |
205 |
| -.. _Packagist: https://packagist.org/packages/symfony/var-dumper |
0 commit comments