2024-08-26 17:37:42 +02:00
2024-05-17 12:55:18 +02:00
2024-06-20 17:52:34 +02:00
2024-06-25 22:18:01 +02:00
2024-01-23 16:06:13 +01:00
2024-06-25 21:55:06 +02:00
2024-06-20 17:52:34 +02:00
2023-08-05 16:39:51 +02:00
2024-06-24 18:01:36 +02:00
2023-01-24 15:02:46 +01: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%