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

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

jessehu/validator
=================

Validator Component for validate variables such as strings, numbers and arrays

v1.0.3(8y ago)124[1 PRs](https://github.com/zhibuzu/validator/pulls)MITPHPPHP &gt;5.3.0

Since Mar 6Pushed 8y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (8)Used By (0)

validator
=========

[](#validator)

Validator Component for validate variables such as strings, numbers and arrays

### Usage

[](#usage)

```
require '../vendor/autoload.php';

use Jessehu\Component\Validator\Validation;

use Jessehu\Component\Validator\Contraints\NotBlank;

$validator = Validation::createValidator();

// use Contraints Object
$violations = $validator->validate('Jessehu', array(
    new NotBlank('this variable can\'t be blank')
));

// or use custom closure
$violations = $validator->validate('Jessehu', array(
    function ($value) {
        if ('Jesse hu' !== $value) {
            return 'variable value must be Jesse hu';
        }

        return true;
    }
));

if (0 !== count($violations)) {
    // 类型错误信息
    foreach ($violations as $violation) {
        echo $violation->getMessage().'';
        echo $vialation->getCodes().'';
    }
}

```

Variable type validator
=======================

[](#variable-type-validator)

validate variable type

### Usage

[](#usage-1)

```
require '../vendor/autoload.php';

use Jessehu\Component\Validator\VariableTypeValidator;

$title = '25日视频直播国王vs勇士 库里一纪录冲历史前3';
$isNbaNews = true;
$score = 45;

$validator = VariableTypeValidator::createValidator();
$violations = $validator->validate(array(
   'title' => array('is_string', $title),
   'isNbaNews' => array('is_bool', $isNbaNews),
   'score' => array('is_int', $score)
));

if (0 !== count($violations)) {
    // 类型错误信息
    foreach ($violations as $violation) {
        echo $violation->getMessage().'';
        echo $vialation->getCode().'';
    }
}

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~24 days

Total

4

Last Release

3262d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/03404aa358091847d7cda6c68197621cb3ec147168401136e53e90ae92a73466?d=identicon)[zhibuzu](/maintainers/zhibuzu)

---

Top Contributors

[![zhibuzu](https://avatars.githubusercontent.com/u/6624333?v=4)](https://github.com/zhibuzu "zhibuzu (16 commits)")

---

Tags

phpvalidator

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[runz0rd/mapper-php

Model mapping, unmapping and validation

17451.9k2](/packages/runz0rd-mapper-php)

PHPackages © 2026

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