Symfony Debug

Symfony's Debug component provides tools to ease debugging PHP code, converting errors into exceptions and formatting fatal errors clearly.

Library
Composer
vv4.4.44
7,172stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity0
Maintenance20
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture78
Code Quality82
Innovation62
Learning Curve82

The Symfony Debug component provides a small set of tools that make debugging PHP code easier. It installs an error handler that turns PHP warnings and notices into catchable exceptions, a debug class loader that surfaces case-mismatch and deprecation problems at autoload time, and an exception handler that renders unhandled and fatal errors in a readable form.

Note that this component has been deprecated since Symfony 4.4 and split into the ErrorHandler and VarDumper components; new projects should use symfony/error-handler instead. It remains widely installed through legacy dependencies and is documented here for reference and for teams maintaining older Symfony 3.x/4.x applications.

What You Get

  • An ErrorHandler that converts PHP errors into exceptions and manages error reporting levels
  • A DebugClassLoader that detects case mismatches, missing parent classes, and deprecated class usage
  • An ExceptionHandler that renders uncaught and fatal errors in a structured, readable format
  • Fatal-error handlers that translate class-not-found and undefined-function errors into helpful messages
  • A BufferingLogger and one-call Debug::enable() bootstrap for quick setup

Common Use Cases

  • Enabling rich error and exception reporting in Symfony 3.x/4.x development environments
  • Turning silent PHP warnings and notices into exceptions to catch bugs early
  • Surfacing autoloading and deprecation problems during class loading
  • Maintaining legacy applications that still depend on the Debug component

Under The Hood

Architecture - The component is organized around three cooperating handlers registered by Debug::enable(): ErrorHandler.php traps PHP’s error callback and rethrows errors as \ErrorException subclasses, ExceptionHandler.php renders uncaught exceptions, and DebugClassLoader.php decorates the Composer autoloader to inspect each loaded class. Specialized FatalErrorHandler implementations under that directory translate class-not-found and undefined-method/function fatals into enhanced exceptions carrying suggestions.

Tech Stack - Pure PHP (>=7.1.3) with a single runtime dependency on psr/log for the bundled BufferingLogger, and a dev dependency on symfony/http-kernel for integration testing. Autoloading is PSR-4 under the Symfony\Component\Debug\ namespace; tests are excluded from the classmap.

Code Quality - The repository ships a PHPUnit test suite under Tests/ and follows Symfony’s strict coding standards and backwards-compatibility rules. Because it is a read-only subtree split, all development, review, and CI happen in the main symfony/symfony monorepo. Development is frozen at 4.4.x since the component is deprecated.

API Design - The surface is deliberately tiny: a one-line Debug::enable() bootstrap covers the common case, while advanced users can instantiate and configure ErrorHandler, ExceptionHandler, and DebugClassLoader directly. Method and class naming follows Symfony conventions, making it predictable for anyone familiar with the framework, though its successor symfony/error-handler is preferred going forward.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search