Archives


Master Symfony2 fundamentals

Be trained by SensioLabs experts (2 to 6 day sessions -- French or English).
trainings.sensiolabs.com

Discover the SensioLabs Support

Access to the SensioLabs Competency Center for an exclusive and tailor-made support on Symfony
sensiolabs.com

Fabien Potencier
New in Symfony 2.3: New Debug Component
by Fabien Potencier – April 11, 2013 – 4 comments

Contributed by
Fabien Potencier
in #7441.

Since the introduction of Symfony2, we have tried to decouple features as much as possible to make useful features easily reusable outside the context of Symfony. And because Composer makes it easy to add a dependency to your project, we have decided to extract the debug feature from HttpKernel to create a new Debug component.

The new Debug Component provides tools to ease debugging PHP code. Enabling all tools is as easy as it can get:

1
2
3
use Symfony\Component\Debug\Debug;

Debug::enable();

The enable() method registers an error handler and an exception handler. If the ClassLoader component is available, a special class loader is also registered.

Here is how you can only register the error handler:

1
2
3
use Symfony\Component\Debug\ErrorHandler;

ErrorHandler::register();

And here is how you can register the exception handler:

1
2
3
use Symfony\Component\Debug\ExceptionHandler;

ExceptionHandler::register();

Documentation has also been updated, but the pull request has not been merged yet.

Have a look at the code on Github, and use symfony/debug in your composer.json file.

The Symfony Standard Edition has also been updated to reflect these changes.

Comments RSS

  • Peter Kokot
    #1 Peter Kokot said on the 2013/04/11 at 17:42
    Awesome. This will be useful. Thanks for the info.
  • Sylvain Mauduit
    #2 Sylvain Mauduit said on the 2013/04/11 at 21:39
    Awesome. As usual :-)
  • Hari K T
    #3 Hari K T said on the 2013/04/12 at 06:14
    Wow nice!
    It seems the api is not updated. Giving a 404.

    Thank you.
  • Lhassan Baazzi
    #4 Lhassan Baazzi said on the 2013/04/12 at 11:34
    +1