承接 cronfy/yii2-web-errorhandler 相关项目开发

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

邮箱: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.08k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2016-10-06