定制 spencer-mortensen/exceptions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

spencer-mortensen/exceptions

最新稳定版本:6.0.3

Composer 安装命令:

composer require spencer-mortensen/exceptions

包简介

Catch fatal errors and warnings that would otherwise be difficult to handle

关键字:

README 文档

README

This project is available as a Composer Package:
spencer-mortensen/exceptions

Overview

Error handling in PHP is complicated, but this library makes it bullet-proof: Create a method to handle exceptions (e.g. $handler->handle($throwable);) and you're good to go!

This library converts all PHP notices, warnings, and errors into exceptions, so you can handle them. It also works on any thrown exceptions that make it up to the global scope. It even catches most of the fatal errors, which would otherwise be impossible to handle.

Usage

Example 1. Enable error handling for the entire program:

new ErrorHandling($errorHandler, E_ALL);

Example 2. Enable error handling ONLY for your portion of the code:

try {
	ErrorHandling::on();
	...
} finally {
	ErrorHandling::off();
}

This converts PHP notices, warnings, and errors into catchable exceptions, but only for the duration of the try/catch block.

Example 3. Show the built-in PHP STDERR messages, so you can see errors while you're working on your error handler. If you're working on your error handler, and you're getting a blank screen, use this:

new ErrorHandling($errorHandler, E_ALL, false);

When you're finished, set everything back to normal:

new ErrorHandling($errorHandler, E_ALL);

See the example area for working code and ideas.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2018-01-01