PHPackages                             seetolight/validator - 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. seetolight/validator

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

seetolight/validator
====================

PHP Validator.

066PHP

Since Oct 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/jzk2008/validator)[ Packagist](https://packagist.org/packages/seetolight/validator)[ RSS](/packages/seetolight-validator/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Validator
=============

[](#php-validator)

前言
--

[](#前言)

公司里的用的是 Yii 框架， Yii 习惯上使用模型校验。而其他框架大都实现了更灵活的校验类。所以自己封装了一个类似的校验类，以 方便在接口处(区别于模型中)对客户端的传值进行校验。

安装
--

[](#安装)

建议使用 composer 进行安装。

基本使用
----

[](#基本使用)

基本使用如下:

```
$requestParams = [
    'name' => 'admin',
    'age' => 100,
    'tel' => '18969143101',
];

class UserValidator extends \JinZhiSu\Validator
{
    protected $ruleMap = [
        'name' => ['required'],
        'age' => ['Integer', 'Min:0', 'Max:125'],
        'tel' => ['required', 'Phone'],
    ];

    protected $message = [
        'name' => '姓名必填',
        'age' => '年龄必须为整数,必须在0到125之间',
        'tel' => '手机号码格式不正确',
    ];

    protected $defaultValues = [
        'age' => 1
    ];
}

$validator = new UserValidator($requestParams);
if (!$validator->check()) {
    var_dump($validator->getLastError());
    die();
}
var_dump($validator->getData());

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

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://avatars.githubusercontent.com/u/22018947?v=4)[seetolight](/maintainers/jzk2008)[@jzk2008](https://github.com/jzk2008)

---

Top Contributors

[![jzk2008](https://avatars.githubusercontent.com/u/22018947?v=4)](https://github.com/jzk2008 "jzk2008 (7 commits)")

### Embed Badge

![Health badge](/badges/seetolight-validator/health.svg)

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

###  Alternatives

[chaoswey/taiwan-id-validator

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

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

PHPackages © 2026

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