Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3847c76

Browse files
committed
Add DebugBundle config reference
1 parent149576e commit3847c76

File tree

4 files changed

+87
-42
lines changed

4 files changed

+87
-42
lines changed

‎components/var_dumper/introduction.rst‎

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ use instead of e.g. :phpfunction:`var_dump`. By using it, you'll gain:
4242
For example::
4343

4444
require __DIR__.'/vendor/autoload.php';
45+
4546
// create a variable, which could be anything!
46-
$someVar ='...';
47+
$someVar = ...;
4748

4849
dump($someVar);
4950

@@ -70,14 +71,14 @@ current PHP SAPI:
7071
#. Run ``composer global require symfony/var-dumper``;
7172
#. Add ``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php``
7273
to your ``php.ini`` file;
73-
#. From time to time, run ``composer global update`` to have the latest
74-
bug fixes.
74+
#. From time to time, run ``composer global update symfony/var-dumper``
75+
to have the latestbug fixes.
7576

7677
DebugBundle and Twig Integration
7778
--------------------------------
7879

79-
The``DebugBundle`` allows greater integration of the component into the
80-
Symfonyfull stack framework. It is enabled by default in the *dev* and *test*
80+
The DebugBundle allows greater integration of the component into the Symfony
81+
full stack framework. It is enabled by default in the *dev* and *test*
8182
environment of the standard edition since version 2.6.
8283

8384
Since generating (even debug) output in the controller or in the model
@@ -98,43 +99,9 @@ Choosing between both is mostly a matter of personal taste, still:
9899
be suited to your use case (e.g. you shouldn't use it in an HTML
99100
attribute or a ``<script>`` tag).
100101

101-
By default for nested variables, dumps are limited to a subset of their
102-
original value. You can configure the limits in terms of:
103-
104-
* maximum number of items to dump,
105-
* maximum string length before truncation.
106-
107-
Since dumping into the toolbar is not always possible - e.g. when working on a
108-
JSON API - you can have an alternate output destination for dumps. This is
109-
configurable with the ``debug.dump_destination`` option, that you can typically
110-
set to ``php://stderr``.
111-
112-
..configuration-block::
113-
114-
..code-block::yaml
115-
116-
debug:
117-
max_items:250
118-
max_string_length:-1
119-
dump_destination:~
120-
121-
..code-block::xml
122-
123-
<?xml version="1.0" encoding="UTF-8" ?>
124-
<containerxmlns="http://symfony.com/schema/dic/debug"
125-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
126-
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
127-
128-
<configmax-items="250"max-string-length="-1"dump-destination="null" />
129-
</container>
130-
131-
..code-block::php
132-
133-
$container->loadFromExtension('debug', array(
134-
'max_items' => 250,
135-
'max_string_length' => -1,
136-
'dump_destination' => null,
137-
));
102+
This behaviour can be changed by configuring the ``dump.dump_destination``
103+
option. Read more about this and other options in
104+
:doc:`the DebugBundle configuration reference</reference/configuration/debug>`.
138105

139106
Dump Examples and Output
140107
------------------------

‎reference/configuration/debug.rst‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
..index::
2+
single: Configuration reference; Framework
3+
4+
DebugBundle Configuration ("debug")
5+
===================================
6+
7+
The DebugBundle allows greater integration of the
8+
:doc:`VarDumper component</components/var_dumper/introduction>` in the
9+
Symfony full-stack framework and can be configured under the ``debug`` key
10+
in your application configuration. When using XML, you must use the
11+
``http://symfony.com/schema/dic/debug`` namespace.
12+
13+
..versionadded::
14+
The DebugBundle was introduced in Symfony 2.6.
15+
16+
..tip::
17+
18+
The XSD schema is available at
19+
``http://symfony.com/schema/dic/debug/debug-1.0.xsd``.
20+
21+
Configuration
22+
-------------
23+
24+
* `max_items`_
25+
* `max_string_length`_
26+
* `dump_destination`_
27+
28+
max_items
29+
~~~~~~~~~
30+
31+
**type**: ``integer`` **default**: ``2500``
32+
33+
This is the maximum number of items to dump. Setting this option to ``-1``
34+
disables the limit.
35+
36+
max_string_length
37+
~~~~~~~~~~~~~~~~~
38+
39+
**type**: ``integer`` **default**: ``-1``
40+
41+
This option configures the maximum string length before truncating the
42+
string. The default value (``-1``) means that strings are never truncated.
43+
44+
dump_destination
45+
~~~~~~~~~~~~~~~~
46+
47+
**type**: ``string`` **default**: ``null``
48+
49+
Configures the output destination of the dumps.
50+
51+
By default, the dumps are shown in the toolbar. Since this is not always
52+
possible (e.g. when working on a JSON API), you can have an alternate output
53+
destination for dumps. Typically, you would set this to ``php://stderr``:
54+
55+
..configuration-block::
56+
57+
..code-block::yaml
58+
59+
debug:
60+
dump_destination:php://stderr
61+
62+
..code-block::xml
63+
64+
<?xml version="1.0" encoding="UTF-8" ?>
65+
<containerxmlns="http://symfony.com/schema/dic/debug"
66+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
67+
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
68+
69+
<configdump-destination="php://stderr" />
70+
</container>
71+
72+
..code-block::php
73+
74+
$container->loadFromExtension('debug', array(
75+
'dump_destination' => 'php://stderr',
76+
));

‎reference/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Reference Documents
1212
configuration/twig
1313
configuration/monolog
1414
configuration/web_profiler
15+
configuration/debug
1516

1617
configuration/kernel
1718

‎reference/map.rst.inc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* :doc:`twig</reference/configuration/twig>`
1414
* :doc:`monolog</reference/configuration/monolog>`
1515
* :doc:`web_profiler</reference/configuration/web_profiler>`
16+
* :doc:`debug</reference/configuration/debug>` (new in 2.6)
1617

1718
* :doc:`Configuring the Kernel (e.g. AppKernel)</reference/configuration/kernel>`
1819

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp