Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • SensioLabs Professional services to help you with Symfony
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by SensioLabs
  1. Home
  2. Documentation
  3. Reference
  4. Debug Configuration Reference (DebugBundle)
  • Documentation
  • Book
  • Reference
  • Bundles
  • Cloud

Table of Contents

  • Configuration
    • max_items
    • min_depth
    • max_string_length
    • dump_destination

Debug Configuration Reference (DebugBundle)

Edit this page

Debug Configuration Reference (DebugBundle)

The DebugBundle integrates the VarDumper component in Symfony applications. All these options are configured under the debug key in your application configuration.

1
2
3
4
5
6
7
8
9
# displays the default config values defined by Symfony
$ php bin/console config:dump-reference framework

# displays the actual config values used by your application
$ php bin/console debug:config framework

# displays the config values used by your application and replaces the
# environment variables with their actual values
$ php bin/console debug:config --resolve-env framework

6.2

The --resolve-env option was introduced in Symfony 6.2.

Note

When using XML, you must use the http://symfony.com/schema/dic/debug namespace and the related XSD schema is available at: https://symfony.com/schema/dic/debug/debug-1.0.xsd

Configuration

max_items

type: integer default: 2500

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

min_depth

type: integer default: 1

Configures the minimum tree depth until which all items are guaranteed to be cloned. After this depth is reached, only max_items items will be cloned. The default value is 1, which is consistent with older Symfony versions.

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, dumps are shown in the WebDebugToolbar when returning HTML. 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:

1
2
3
# config/packages/debug.yaml
debug:
    dump_destination: php://stderr
1
2
3
4
5
6
7
8
9
10
11
<!-- config/packages/debug.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"
    xmlns:debug="http://symfony.com/schema/dic/debug"
    xsi:schemaLocation="http://symfony.com/schema/dic/services
        https://symfony.com/schema/dic/services/services-1.0.xsd
        http://symfony.com/schema/dic/debug https://symfony.com/schema/dic/debug/debug-1.0.xsd">

    <debug:config dump-destination="php://stderr"/>
</container>
1
2
3
4
// config/packages/debug.php
$container->loadFromExtension('debug', [
    'dump_destination' => 'php://stderr',
]);

Configure it to "tcp://%env(VAR_DUMPER_SERVER)%" in order to use the ServerDumper feature.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version
    We stand with Ukraine.
    Version:

    Symfony 6.2 is backed by

    Symfony 6.2 is backed by

    Show your Sylius expertise

    Show your Sylius expertise

    Symfony Code Performance Profiling

    Symfony Code Performance Profiling

    Symfony footer

    ↓ Our footer now uses the colors of the Ukrainian flag because Symfony stands with the people of Ukraine.

    Avatar of Max Grigorian, a Symfony contributor

    Thanks Max Grigorian (@maxakawizard) for being a Symfony contributor

    1 commit • 85 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • Symfony at a Glance
      • Symfony Components
      • Case Studies
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • SymfonyConnect
      • Support
      • How to be Involved
      • Code of Conduct
      • Events & Meetups
      • Projects using Symfony
      • Downloads Stats
      • Contributors
      • Backers
    • Blog

      • Events & Meetups
      • A week of symfony
      • Case studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Documentation
      • Living on the edge
      • Releases
      • Security Advisories
      • SymfonyInsight
      • Twig
      • SensioLabs
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Deployed on

    Follow Symfony