承接 confetticode/error-handler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

confetticode/error-handler

Composer 安装命令:

composer require confetticode/error-handler

包简介

A great unified error handler for PHP

关键字:

README 文档

README

Installation

Install confetticode/error-handler as a Composer dependency in your project.

composer require confetticode/error-handler

Usage

Create a new instance of the ErrorHandler class. By default, HtmlDisplayer will be initialized. This will display an error html page with status code, message and short description.

$errors = new \Confetti\ErrorHandler\ErrorHandler();

Register the $errors instance as the global error handler by doing some logic with set_error_handler, set_exception_handler and register_shutdown_function. Then, any uncaught errors/exceptions will be handled.

$errors->register();

You can change displayer by calling the setDisplayer method.

// Natively available.
$errors->setDisplayer(new \ConfetiCode\ErrorHandler\SymfonyDisplayer);

// To use IgnitionDisplayer, you have to install "spatie/ignition".
$errors->setDisplayer(new \ConfetiCode\ErrorHandler\IgnitionDisplayer);

Integrate with monolog/monolog, eg: writing logs into files.

composer require monolog/monolog
$logger = new \Monolog\Logger('testing');

$logger->setHandlers([
    new \Monolog\Handler\StreamHandler(__DIR__.'/log.txt'),
]);

$reporter = new \ConfettiCode\ErrorHandler\LogReporter($logger);

$errors->setReporter($reporter);

You may try out error.php file for a quick overview.

License

The confetticode/error-handler package is licensed under the MIT license.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固