Skip to content
The ErrorHandler component provides tools to manage errors and ease debugging PHP code.
PHP CSS JavaScript
Branch: master
Clone or download

Latest commit

nicolas-grekas Merge branch '5.1'
* 5.1:
  Handle fetch mode deprecation of DBAL 2.11.
  Fixed security-* package dependencies
  Fixed handling of CSRF logout error
  [WebProfilerBundle] changed label of memory usage in time panel (Mb into MiB)
  [DotEnv][WebLink][Templating][ErrorHandler] Updated README with minimal example
Latest commit 55e9b01 May 28, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Error [ErrorHandler] Rework fatal error handlers Sep 30, 2019
ErrorEnhancer [ErrorHandler] Remove Symfony ClassLoader support in an error enhancer Nov 8, 2019
ErrorRenderer Merge branch '5.0' Mar 30, 2020
Exception Merge branch '4.4' into 5.0 May 24, 2020
Resources Merge branch '5.0' May 4, 2020
Tests Merge branch '5.0' into 5.1 May 24, 2020
.gitattributes add missing gitattributes for phpunit-bridge Mar 27, 2020
.gitignore Add a new ErrorHandler component (mirror of the Debug component) Jul 18, 2019
BufferingLogger.php [ErrorHandler] merge and remove the ErrorRenderer component Nov 10, 2019
CHANGELOG.md [ErrorHandler][FrameworkBundle] better error messages in failing tests Mar 16, 2020
Debug.php [ErrorHandler] silence warning when zend.assertions=-1 Feb 13, 2020
DebugClassLoader.php Use is_file() instead of file_exists() where possible Apr 23, 2020
ErrorHandler.php [ErrorHandler] Remove trigger_deprecation frame from trace Apr 6, 2020
LICENSE Update year in license files Jan 1, 2020
README.md [DotEnv][WebLink][Templating][ErrorHandler] Updated README with minim… May 26, 2020
ThrowableUtils.php [ErrorHandler] Forward \Throwable Sep 10, 2019
composer.json Merge branch '5.1' May 20, 2020
phpunit.xml.dist [Debug][ErrorHandler] cleanup phpunit.xml.dist files May 1, 2020

README.md

ErrorHandler Component

The ErrorHandler component provides tools to manage errors and ease debugging PHP code.

Getting Started

$ composer require symfony/error-handler
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\ErrorHandler\DebugClassLoader;

Debug::enable();

// or enable only one feature
//ErrorHandler::register();
//DebugClassLoader::enable();

$data = ErrorHandler::call(static function () use ($filename, $datetimeFormat) {
    // if any code executed inside this anonymous function fails, a PHP exception
    // will be thrown, even if the code uses the '@' PHP silence operator
    $data = json_decode(file_get_contents($filename), true);
    $data['read_at'] = date($datetimeFormat);
    file_put_contents($filename, json_encode($data));

    return $data;
});

Resources

You can’t perform that action at this time.