PHP MIT

error-handler

Provides tools to manage errors and ease debugging PHP code

S

symfony

Dernière activité 22 sept. 2026
symfony/error-handler

2,7 k

étoiles

20

forks

1

issues ouvertes

componentphpsymfonysymfony-component

Ce README est souvent en anglais.

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

This package is looking for a backer.

Help Symfony by sponsoring its development!

Resources

Projets similaires

Provides mechanisms for walking through any arbitrary PHP variable

PHPcomponentdebugdump
Ssymfony
7,4 k étoiles102

Provides tools to validate values

PHPcomponentphpsymfony
Ssymfony
2,7 k étoiles106

Provides tools that allow your application components to communicate with each other by dispatching events and listening to them

PHPcomponentphpsymfony
Ssymfony
8,5 k étoiles66