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

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

maer/validator
==============

A simple validation library

1.0.0(8y ago)448011MITPHPPHP &gt;=7.0.0

Since Mar 17Pushed 4y ago3 watchersCompare

[ Source](https://github.com/magnus-eriksson/validator)[ Packagist](https://packagist.org/packages/maer/validator)[ RSS](/packages/maer-validator/feed)WikiDiscussions develop Synced 3w ago

READMEChangelogDependencies (2)Versions (12)Used By (1)

Validator
=========

[](#validator)

### Simple usage

[](#simple-usage)

```
$data = [
    'foo' => 'bar',
    'lorem' => [
        'ipsum' => 'loremipsum',
    ]
];

$rules = [
    'foo'         => ['required', 'in:bar,foo'],
    'lorem.ipsum' => ['required', 'minLength:10'],
],

$v = new \Maer\Validator\Validator($data, $rules);

if ($v->isValid() === false) {
    print_r($v->getErrors());
}
```

### Add custom rules

[](#add-custom-rules)

```
class MyRules extends \Maer\Validator\Sets\AbstractSet
{
    public function myRule(mixed $input): string|bool
    {
        if ($input === 'hello-world') {
            return true;
        }

        return "Input must be hello-world";
    }

    public function rules(): array
    {
        return [
            'myNewRule' => [$this, 'myRule'],
        ];
    }
}

$data = [
    'foo' => 'hello-world',
];

$rules = [
    'foo' => ['myNewRule'],
];

$v = new Validator($data, $rules);

// Add ruleset
$v->addSet(new MyRules);
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

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

Recently: every ~135 days

Total

9

Last Release

2937d ago

Major Versions

0.4.1 → 1.0.02018-06-08

PHP version history (3 changes)0.1.0PHP &gt;=5.4.0

0.4.1PHP &gt;=5.5.9

1.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ada6171adca1bf89432dd54fff188ef3d890a71734278bd06b54487f45b5695?d=identicon)[maer](/maintainers/maer)

---

Top Contributors

[![magnus-eriksson](https://avatars.githubusercontent.com/u/3640297?v=4)](https://github.com/magnus-eriksson "magnus-eriksson (20 commits)")

---

Tags

phpvalidation

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[chaoswey/taiwan-id-validator

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

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

PHPackages © 2026

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