cronfy/yii2-web-errorhandler 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

cronfy/yii2-web-errorhandler

最新稳定版本:v0.0.1

Composer 安装命令:

composer require cronfy/yii2-web-errorhandler

包简介

Yii2 customizable error handler

README 文档

README

Can be customized in terms of which error types should be converted to exceptions or only logged.

Installation

php composer.phar require cronfy/yii2-web-errorhandler

Usage

Replace errorHandler component in application configuration and configure error types you want to convert to exceptions or log. Default is E_ALL | E_STRICT.

Example:

... 'components' => [ 'errorHandler' => [ 'class' => 'cronfy\yii\web\ErrorHandler', 'typesToExceptions' => YII_DEBUG ? (E_ALL | E_STRICT) : false, 'typesToLog' => E_ALL | E_STRICT, ], ], ...

This configuration will convert all php notices and warnings to exceptions only in debug mode, and none in production environment. Errors will be logged both in debug and production modes. You can customize error types that go to log or convereted to exceptions.

Errors are logged via internal Yii2 log component.

You can enable/disable ErrorHandler for particular error types by setting typesToHandle option. All error types not specified there will be forwarded to internal php error handler:

... 'components' => [ 'errorHandler' => [ 'class' => 'cronfy\yii\web\ErrorHandler', 'typesToHandle' => E_ALL & ~E_NOTICE, // NOTE: although E_ALL is set here, PHP Notices will not be converted to exceptions,  // because they were disabled via 'typesToHandle' option above. // PHP Warnings and other errors will be converted to exceptions. 'typesToExceptions' => E_ALL, ], ], ...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固