2025-07-31 11:31:17 +02:00
2024-05-17 12:55:18 +02:00
2025-05-29 09:19:28 +02:00
2024-11-05 16:34:55 +01:00
2025-01-07 10:39:55 +01:00
2025-07-31 11:31:17 +02:00
2025-07-08 19:39:48 +02:00
2025-07-15 11:40:20 +02:00
2025-07-08 19:39:48 +02:00
2023-01-24 15:02:46 +01:00
2025-07-31 11:31:17 +02:00
2023-12-08 15:23:08 +01:00
2021-06-29 11:21:24 +02: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

Description
⚠️ ARCHIVED: Original GitHub repository no longer exists. Preserved as backup on 2026-01-22T16:32:42.612Z
Readme MIT 1.2 MiB
Languages
PHP 92.1%
CSS 4.7%
JavaScript 3.2%