PHPackages                             wangyu/tp-exception - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wangyu/tp-exception

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wangyu/tp-exception
===================

TP5.1 的异常核心类，含多异常输出，异常类型判断

144PHP

Since Jul 4Pushed 6y agoCompare

[ Source](https://github.com/china-wangyu/tp-exception)[ Packagist](https://packagist.org/packages/wangyu/tp-exception)[ RSS](/packages/wangyu-tp-exception/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

tp-exception
============

[](#tp-exception)

TP5.1 的异常基类扩展

`composer` 安装
=============

[](#composer-安装)

```
composer require wangyu/tp-exception
```

使用说明
====

[](#使用说明)

（1）首先继承 `\WangYu\BaseException`
-------------------------------

[](#1首先继承-wangyubaseexception)

- 例如：

```
class RouteException extends \WangYu\BaseException
{
    public $code = 400;
    public $message = '反射路由设置错误';
    public $error_code = 66668;
}
```

(2) 修改 `thinkphp5.1` 的 `/config/app.php` 里面 `exception_handle`参数
----------------------------------------------------------------

[](#2-修改-thinkphp51-的-configappphp-里面-exception_handle参数)

修改为以下内容

```
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle'       => 'WangYu\Exception',
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a848ecfc636b5cae37b9f830a2caa3f8fa9cbda3b5bc0237203f5bd9296b533d?d=identicon)[china-wangyu](/maintainers/china-wangyu)

---

Top Contributors

[![china-wangyu](https://avatars.githubusercontent.com/u/31000104?v=4)](https://github.com/china-wangyu "china-wangyu (1 commits)")

### Embed Badge

![Health badge](/badges/wangyu-tp-exception/health.svg)

```
[![Health](https://phpackages.com/badges/wangyu-tp-exception/health.svg)](https://phpackages.com/packages/wangyu-tp-exception)
```

###  Alternatives

[panphp/pan

A simple, lightweight, and privacy-focused product analytics php package.

1.2k94.6k5](/packages/panphp-pan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
