English spoken conference

You are browsing the Symfony 5.0 documentation, which changes significantly from Symfony 3.x. If your app doesn't use Symfony 5.0 yet, browse the Symfony 3.4 documentation.

The Debug Component

5.0 version

The Debug Component

The Debug component provides tools to ease debugging PHP code.

Deprecated since version 4.4: In Symfony versions before 4.4, this component also provided error and exception handlers. In Symfony 4.4 they were deprecated in favor of their equivalent handlers included in the new ErrorHandler component.

Installation

1
$ composer require --dev symfony/debug

Note

If you install this component outside of a Symfony application, you must require the vendor/autoload.php file in your code to enable the class autoloading mechanism provided by Composer. Read this article for more details.

Usage

The Debug component provides several tools to help you debug PHP code. Enable all of them by calling this method:

use Symfony\Component\Debug\Debug;

Debug::enable();

Caution

You should never enable the debug tools in a production environment as they might disclose sensitive information to the user.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.