Skip to content

Commit

Permalink
minor #5584 Add DebugBundle config reference (WouterJ)
Browse files Browse the repository at this point in the history
This PR was submitted for the 2.6 branch but it was merged into the 2.7 branch instead (closes #5584).

Discussion
----------

Add DebugBundle config reference

After this PR, the components still contain some information about full-stack, which we should move to a cookbook recipe imo.

| Q | A
| --- | ---
| Doc fix? | yes
| New docs? | no
| Applies to | 2.6+
| Fixed tickets | -

Commits
-------

580f96f Add DebugBundle config reference
  • Loading branch information
xabbuh committed Oct 3, 2015
2 parents beaa7a4 + 580f96f commit 2c9e8d1
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 28 deletions.
37 changes: 9 additions & 28 deletions components/var_dumper/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ use instead of e.g. :phpfunction:`var_dump`. By using it, you'll gain:
For example::

require __DIR__.'/vendor/autoload.php';

// create a variable, which could be anything!
$someVar = '...';
$someVar = ...;

dump($someVar);

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

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

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

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

By default for nested variables, dumps are limited to a subset of their
original value. You can configure the limits in terms of:

* maximum number of items to dump,
* maximum string length before truncation.

.. configuration-block::

.. code-block:: yaml
debug:
max_items: 250
max_string_length: -1
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/debug"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
<config max-items="250" max-string-length="-1" />
</container>
This behaviour can be changed by configuring the ``dump.dump_destination``
option. Read more about this and other options in
:doc:`the DebugBundle configuration reference </reference/configuration/debug>`.

Using the VarDumper Component in your PHPUnit Test Suite
--------------------------------------------------------
Expand Down
76 changes: 76 additions & 0 deletions reference/configuration/debug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
.. index::
single: Configuration reference; Framework

DebugBundle Configuration ("debug")
===================================

The DebugBundle allows greater integration of the
:doc:`VarDumper component </components/var_dumper/introduction>` in the
Symfony full-stack framework and can be configured under the ``debug`` key
in your application configuration. When using XML, you must use the
``http://symfony.com/schema/dic/debug`` namespace.

.. versionadded::
The DebugBundle was introduced in Symfony 2.6.

.. tip::

The XSD schema is available at
``http://symfony.com/schema/dic/debug/debug-1.0.xsd``.

Configuration
-------------

* `max_items`_
* `max_string_length`_
* `dump_destination`_

max_items
~~~~~~~~~

**type**: ``integer`` **default**: ``2500``

This is the maximum number of items to dump. Setting this option to ``-1``
disables the limit.

max_string_length
~~~~~~~~~~~~~~~~~

**type**: ``integer`` **default**: ``-1``

This option configures the maximum string length before truncating the
string. The default value (``-1``) means that strings are never truncated.

dump_destination
~~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``null``

Configures the output destination of the dumps.

By default, the dumps are shown in the toolbar. Since this is not always
possible (e.g. when working on a JSON API), you can have an alternate output
destination for dumps. Typically, you would set this to ``php://stderr``:

.. configuration-block::

.. code-block:: yaml
debug:
dump_destination: php://stderr
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/debug"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/debug http://symfony.com/schema/dic/debug/debug-1.0.xsd">
<config dump-destination="php://stderr" />
</container>
.. code-block:: php
$container->loadFromExtension('debug', array(
'dump_destination' => 'php://stderr',
));
1 change: 1 addition & 0 deletions reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Reference Documents
configuration/twig
configuration/monolog
configuration/web_profiler
configuration/debug

configuration/kernel

Expand Down
1 change: 1 addition & 0 deletions reference/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* :doc:`twig </reference/configuration/twig>`
* :doc:`monolog </reference/configuration/monolog>`
* :doc:`web_profiler </reference/configuration/web_profiler>`
* :doc:`debug </reference/configuration/debug>` (new in 2.6)

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

Expand Down

0 comments on commit 2c9e8d1

Please sign in to comment.