lucinda/errors
Composer 安装命令:
composer require lucinda/errors
包简介
Bootstraps errors and handles them via reporters and renderers
README 文档
README
Like any other scripting language, PHP has two types of errors:
- syntax errors: language errors in your script that cause immediate failure. These errors cause script to exit immediately without going through a listenable shutdown phase. Thankfully though, they are easily dealt with by using a modern IDE (such as Eclipse) that highlights syntax errors.
- execution errors: errors that appear while a correctly written script is executed. PHP recognizes following types of execution errors:
- fatal errors: self-handled errors causing script to exit, while a message is displayed and a log entry is recorded (eg: a non-existent method is called)
- non-fatal errors: self-handled errors causing script to continue execution, while a message is displayed and a log entry is recorded (eg: a non-existent entry in an array is accessed)
- exceptions: user-handled errors that can be manually thrown and handled
Ideally, errors should have thrown an exception able to be user-handled (to make the the whole process of error handling controllable from a single point), but up until version 7.0 users had to manually direct self-handled errors & uncaught exceptions to user-defined exceptions in order to achieve a single point of control for errors flow. This functionality, primitive as it is, provides a hook for an AOP layer that non-destructively listens to application for cross-cutting concerns (errors), keeping all other components strictly dedicated to their purpose and oblivious of error handling.
ErrorsAPI provides a thin layer of abstraction (skeleton) for unified error handling (redirecting all uncaught error to an errors' front controller). Its control point is the ErrorHandler class, able to register reporters (storage mediums in which error will be logged into) and renderer (entity that will perform response back to caller), then handle any exception by delegating to registered reporters and renderer. In order to handle PHP execution errors as well, API turns on reporting for all PHP errors then redirects them to a PHPException class, via native set_error_handler & register_shutdown_function. From that moment on, every PHP execution error will automatically throw a PHPException, which is then delegated to an ErrorHandler instance that must be registered beforehand.
More information here:
http://www.lucinda-framework.com/errors-api
lucinda/errors 适用场景与选型建议
lucinda/errors 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.32k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「aop」 「errors」 「renderer」 「handler」 「aspect oriented programming」 「reporter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lucinda/errors 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lucinda/errors 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lucinda/errors 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Ray.Di for Laravel
Asynchronous Sentry for Symfony - Fire and forget
Monitors errors and exceptions and reports them to Rollbar
Extremely simple and standard compliant view implementation of MVC pattern
Lucinda Framework 4.0: High performance, component-based PHP application skeleton
Nette integration for Sentry (http://getsentry.com)
统计信息
- 总下载量: 6.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-07