symfony/error-handler
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
psr/log | 3.0.0 | 6.77 kB | MIT | prod | |
symfony/var-dumper | v7.0.0 | - | MIT | prod |
The Symfony/error-handler is a robust tool designed for managing errors and simplifying the debugging process in your PHP code. It's an essential part of the Symfony ecosystem, renowned for its ability to streamline error handling and enhance your overall coding efficiency.
To use the Symfony/error-handler, you'll need to follow a few straightforward steps. Kick off by installing the package via composer, using the command: $ composer require symfony/error-handler
. Once installed, you can incorporate it into your PHP code as shown below:
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\ErrorHandler\DebugClassLoader;
Debug::enable();
// You can also enable only one feature if preferred
//ErrorHandler::register();
//DebugClassLoader::enable();
// To use a custom generic template when debug is not enabled
// HtmlErrorRenderer::setTemplate('/path/to/custom/error.html.php');
$data = ErrorHandler::call(static function () use ($filename, $datetimeFormat) {
// Any failed code executed inside this anonymous function throws a PHP exception
// 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;
});
The Symfony/error-handler documentation can be found within the Symfony's main repository. However, specifics about its usage, issues and contributions can be found at https://symfony.com/doc/current/contributing/index.html for contributions, https://github.com/symfony/symfony/issues for reporting issues, and https://github.com/symfony/symfony/pulls for sending Pull Requests. Your contributions and reports about any encountered issues are highly encouraged, as they contribute to steady improvements of the Symfony/error-handler.