PHPackages                             ikaijian/laravel-constant - 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. ikaijian/laravel-constant

ActiveLibrary

ikaijian/laravel-constant
=========================

php,constant,enum,枚举类，错误码

v0.0.2(4y ago)07MITPHPPHP ^7.1

Since Dec 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ikaijian/laravel-constant)[ Packagist](https://packagist.org/packages/ikaijian/laravel-constant)[ RSS](/packages/ikaijian-laravel-constant/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (3)Used By (0)

 laravel-constant
==================

[](#-laravel-constant-)

 枚举,错误码,constant,enum,统一管理错误码

安装
--

[](#安装)

```
composer require ikaijian/laravel-constant

```

使用
--

[](#使用)

### 定义枚举类,继承ikaijian/laravel-constant的抽象类

[](#定义枚举类继承ikaijianlaravel-constant的抽象类)

```
class ErrorCode extends EnumAbstract
{
    /**
     * @Message('TOKEN失效')
     */
    public static INVALID_TOKEN = 1020;
}

```

### 获取枚举

[](#获取枚举)

```
$code = ErrorCode::INVALID_TOKEN;
$message = ErrorCode::getMessage($code);

```

### 获取枚举数组

[](#获取枚举数组)

```
$message = ErrorCode::toArray();

```

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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.

###  Release Activity

Cadence

Every ~5 days

Total

2

Last Release

1561d ago

PHP version history (2 changes)v0.0.1PHP ^7.4

v0.0.2PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8a17d5ee11ffb61bebc086351e7234f36fc2537725c8664cea90239f7bd66e7?d=identicon)[ikaijian](/maintainers/ikaijian)

---

Top Contributors

[![ikaijian](https://avatars.githubusercontent.com/u/40664684?v=4)](https://github.com/ikaijian "ikaijian (8 commits)")

### Embed Badge

![Health badge](/badges/ikaijian-laravel-constant/health.svg)

```
[![Health](https://phpackages.com/badges/ikaijian-laravel-constant/health.svg)](https://phpackages.com/packages/ikaijian-laravel-constant)
```

PHPackages © 2026

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