ovr/phalcon-pretty-exceptions
Composer 安装命令:
composer require ovr/phalcon-pretty-exceptions
包简介
Beauty-exceptions plugin for Phalcon
README 文档
README
Phalcon is a web framework delivered as a C extension providing high performance and lower resource consumption.
Pretty Exceptions is an utility to show exceptions/errors/warnings/notices using a nicely visualization.
This utility is not intended to be used in a production stage.
This utility catches uncatched exceptions, remember to remove any try/catch that avoid the utility can work.
The code in this repository is written in PHP.
Automatic Usage
The easiest way to use this utility is include its 'loader':
require '/path/to/pretty-exceptions/loader.php';
Manual include
Or you could include the utility manually or via an autoloader:
//Requiring the file require '/path/to/pretty-exceptions/Library.php'; //Or using an autoloader $loader = new Phalcon\Loader(); $loader->registerNamespaces(array( 'Phalcon\\Utils' => '/path/to/pretty-exceptions/Library/Phalcon/Utils/' )); $loader->register();
Usage
Listen for exceptions:
set_exception_handler(function($e) { $p = new \Phalcon\Utils\PrettyExceptions(); return $p->handle($e); });
Listen for user errors/warnings/notices:
set_error_handler(function($errorCode, $errorMessage, $errorFile, $errorLine) { $p = new \Phalcon\Utils\PrettyExceptions(); return $p->handleError($errorCode, $errorMessage, $errorFile, $errorLine); });
Options
The following is the way to configure the utility:
$p = new \Phalcon\Utils\PrettyExceptions(); //Change the base uri for static resources $p->setBaseUri('/'); //Set if the backtrace must be shown $p->showBacktrace(true); //Set whether if open the user files and show its code $p->showFiles(true); //Set whether show the complete file or just the relevant fragment $p->showFileFragment(true); /** * Set whether show human readable dump of current Phalcon application instance * Can optionally pass a Phalcon application instance as a prameter in the * constructor, or as the last parameter of PrettyExceptions::handle() and * PrettyExceptions::handleError() */ $p->showApplicationDump(true); //Change the CSS theme (default, night or minimalist) $p->setTheme('default'); //Handle the error/exception //...
Live Demo
ovr/phalcon-pretty-exceptions 适用场景与选型建议
ovr/phalcon-pretty-exceptions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.27k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 10 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ovr/phalcon-pretty-exceptions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ovr/phalcon-pretty-exceptions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-10-02