Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/symfony/error-handler
Provides tools to manage errors and ease debugging PHP code
https://github.com/symfony/error-handler
component php symfony symfony-component
Last synced: 3 days ago
JSON representation
Provides tools to manage errors and ease debugging PHP code
- Host: GitHub
- URL: https://github.com/symfony/error-handler
- Owner: symfony
- License: mit
- Created: 2019-07-18T08:42:44.000Z (over 5 years ago)
- Default Branch: 7.2
- Last Pushed: 2025-01-07T13:09:47.000Z (23 days ago)
- Last Synced: 2025-01-20T20:11:14.647Z (10 days ago)
- Topics: component, php, symfony, symfony-component
- Language: PHP
- Homepage: https://symfony.com/error-handler
- Size: 725 KB
- Stars: 2,602
- Watchers: 5
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
ErrorHandler Component
======================The ErrorHandler component provides tools to manage errors and ease debugging PHP code.
Getting Started
---------------```bash
composer require symfony/error-handler
``````php
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();// If you want 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) {
// 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
---------* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
in the [main Symfony repository](https://github.com/symfony/symfony)