PHPackages                             hhvp/check - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. hhvp/check

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

hhvp/check
==========

一个验证类

013PHP

Since Nov 2Pushed 8y agoCompare

[ Source](https://github.com/HHVP/Check)[ Packagist](https://packagist.org/packages/hhvp/check)[ RSS](/packages/hhvp-check/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Check
=====

[](#check)

简介:
---

[](#简介)

在写项目的时候总是需要用到表单验证

所以结合自己的思路，写了一个自己喜欢的验证类；

### 适用php版本：

[](#适用php版本)

php5.4+
验证的实现方法：
--------

[](#验证的实现方法)

```
Check::values($values)->rules($rules)->msgs($msgs)->check();

```

参数举例：

1. $values -&gt; 数组 （需要验证的值）

    ```
    $values ＝ ［
    	'title' => 'abcdefg',
    	'sex' => 'man',
    ];

    ```
2. $rules -&gt; array（验证的规则）

    ```
    $rules ＝ ［
    	'title' => 'required|between:2,10|numeric',
    	'sex' => 'required',
    ];

    ```
3. $msgs -&gt; array（自定义验证后返回的错误提示）

    ```
    $msgs ＝ ［
    	'title' => [
                'required'=>'小伙子,标题不能为空',
                'between'=>'长度要在{$option1} 与 {$option2} 之间',
                'numeric'=>'必须是数字哦',
    	],
    	'sex' => [
    	    'required'=>'小伙子,性别不能为空',
    	]
    ];

    ```

已经写好的规则有：
---------

[](#已经写好的规则有)

1. `required` 必填项
2. `between` 介于`min`与`max`之间

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.4% 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/fbb49ff8535e4feb86bc56485ae81b51a3c56a62bdbcf162c46cdffc649e7bb1?d=identicon)[HHVP](/maintainers/HHVP)

---

Top Contributors

[![hys5389](https://avatars.githubusercontent.com/u/25189070?v=4)](https://github.com/hys5389 "hys5389 (32 commits)")[![HHVP](https://avatars.githubusercontent.com/u/30711280?v=4)](https://github.com/HHVP "HHVP (3 commits)")

### Embed Badge

![Health badge](/badges/hhvp-check/health.svg)

```
[![Health](https://phpackages.com/badges/hhvp-check/health.svg)](https://phpackages.com/packages/hhvp-check)
```

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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