paragonie/corner
Composer 安装命令:
composer require paragonie/corner
包简介
Generic PHP Exceptions and Errors, made user-friendly.
README 文档
README
PHP Exceptions and Errors designed to prevent your users from sharp corners. Inspired by Rust's helpful error messages.
- Version 2.x: Requires PHP 7.1 or newer.
- Version 1.x: Requires PHP 5.4 or newer.
Motivation
There are already libraries like Whoops which focus on taking existing uncaught Exceptions and giving them a user interface.
Rather than take control of your entire UI output, Corner extends the base
Throwable interface and Exception/Error classes and makes them more useful
even in non-UI contexts.
Corner's Extended Exception API
getHelpfulMessage()
What exactly is going on here?
Imagine an email. Throwable::getMessage() can be likened to the
subject line. In traditional exceptions, the closest thing you have
to a message body is getTraceAsString().
In Corner, the "helpful message" is meant to be a full-text explanation of the problem. ASCII art diagrams (hard-coded or generated from the source code, if applicable) are permitted.
getSnippet($before = 0, $after = 0, $traceWalk = 0)
What was the code surrounding the exception doing?
By default, this returns the line of PHP code that triggered the exception.
You can optionally pass a number of leading and trailing lines to this method to read more text from the source code file. The third argument allows you to excerpt snippets of code from within the stack trace.
The main use case for getSnippet() is to generate helpful error messages
for getHelpfulMessage().
getSupportLink()
Where can I find help?
The intent of this method is to give the developer using your project the quickest possible path to troubleshooting and solving the problem that they're most likely facing if this Exception / Error gets thrown.
If possible, link to a specific section of your project's documentation (including page anchors, if applicable) to get the developer closer to the solution to whatever problem they're encountering.
paragonie/corner 适用场景与选型建议
paragonie/corner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 701.14k 次下载、GitHub Stars 达 63, 最近一次更新时间为 2018 年 12 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 paragonie/corner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 paragonie/corner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 701.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 63
- 点击次数: 25
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: ISC
- 更新时间: 2018-12-20