ErrorHandler Component

提供管理错误和方便调试 PHP 代码的工具。「Provides tools to manage errors and ease debugging PHP code」

Github星跟踪图

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

主要指标

概览
名称与所有者symfony/error-handler
主编程语言PHP
编程语言PHP (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2019-07-18 08:42:44
推送于2025-03-28 13:37:16
最后一次提交
发布数211
最新版本名称v7.2.5 (发布于 2025-03-28 13:34:11)
第一版名称v4.4.0-BETA1 (发布于 2019-11-12 17:47:33)
用户参与
星数2.6k
关注者数5
派生数19
提交数745
已启用问题?
问题数0
打开的问题数0
拉请求数0
打开的拉请求数0
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?