parsaaghayi-backend/vendor/symfony/error-handler
DevOps c9a688e80d
Some checks failed
Deploy Backend / deploy (push) Has been cancelled
chore: commit vendor directory for fully offline builds
2026-06-28 18:08:40 +00:00
..
Command chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Error chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
ErrorEnhancer chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
ErrorRenderer chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Exception chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Internal chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Resources chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
BufferingLogger.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
CHANGELOG.md chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
composer.json chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Debug.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
DebugClassLoader.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
ErrorHandler.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
LICENSE chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
README.md chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
ThrowableUtils.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00

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();

// 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