awesomite/error-dumper 问题修复 & 功能扩展

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

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

awesomite/error-dumper

Composer 安装命令:

composer require awesomite/error-dumper

包简介

Pretty preview of errors and exceptions

README 文档

README

Latest Stable Version Latest Unstable Version Codacy Badge Coverage Status Build Status

Debugger integrated with PhpStorm. ErrorDumper allows you to catch all kinds of errors and exceptions in PHP. You will be able to serialize, restore and display them later in readable form. @See example.

Installation

composer require awesomite/error-dumper

Screenshots

HTML

Exception displayed as HTML

CLI

Exception displayed in terminal

How to use?

<?php

use Awesomite\ErrorDumper\Handlers\ErrorHandler;
use Awesomite\ErrorDumper\Listeners\OnExceptionCallable;
use Awesomite\ErrorDumper\Listeners\OnExceptionDevView;
use Awesomite\ErrorDumper\Views\ViewFactory;

/**
 * Create new error handler.
 * If $mode is null will be used default value E_ALL | E_STRICT.
 * 
 * @see http://php.net/manual/en/errorfunc.constants.php
 */
$handler = new ErrorHandler(/* optional $mode = null */);

/**
 * Create and push new error listener,
 * this handler will print programmer-friendly stack trace.
 */
$devViewListener = new OnExceptionDevView(ViewFactory::create());
$handler->pushListener($devViewListener);

/**
 * Create and push new custom error listener.
 */
$handler->pushListener(new OnExceptionCallable(function ($exception) {
    // do something with $exception
}));

/**
 * Create and push new custom error listener,
 * this handler will be used only when $exception is instance of \RuntimeException.
 */
$handler->pushListener(new OnExceptionCallable(function (\RuntimeException $exception) {
    // do something with $exception
}));

/**
 * Exit script when error has been detected after executing all listeners.
 */
$handler->exitAfterTrigger(true);

/**
 * Register error handler.
 * 
 * Possible types:
 *   - ErrorHandler::TYPE_ERROR
 *   - ErrorHandler::TYPE_EXCEPTION
 *   - ErrorHandler::TYPE_FATAL_ERROR
 */
$handler->register(/* optional bitmask $types = ErrorHandler::TYPE_ALL */);

Read documentation.

Versioning

The version numbers follow the Semantic Versioning 2.0.0 scheme.

Examples

To run examples you need at least PHP 5.4.

composer update --dev
bin/webserver.sh

Execute above commands and open in your browser url http://localhost:8001. To run example in terminal, execute bin/test.php.

Content Security Policy

This library uses *.js files hosted on maxcdn.bootstrapcdn.com and code.jquery.com (@see \Awesomite\ErrorDumper\Views\ViewHtml::getResources). Add those domains to your Content-Security-Policy header during display errors.

Symfony integration

Error Dumper Bundle

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固