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

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

tyurderi/validator
==================

simple php form validator

1.0.1(10y ago)171MITPHP

Since May 31Pushed 10y agoCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Simple PHP Validator
--------------------

[](#simple-php-validator)

This is my version of a simple php validator class.

### Install

[](#install)

```
composer require tyurderi/validator

```

### Usage

[](#usage)

```
$v = new Validator\Validator();

$v->addRule('unique_username', function($fields, $value, $params) {
    // logic goes here
    return true;
});

$v->add('username', 'tyurderi', 'required|min:3|max:30|unique_username', array(
    'required'        => 'The username is required.',
    'min'             => 'The username should be at least 3 characters long.',
    'max'             => 'The username should be at most 30 characters long.',
    'unique_username' => 'The username is already in use.'
));

$v->validate();

if ($v->passes())
{
    echo 'Validation was successfully!';
}
else
{
    echo 'Validation failed.', PHP_EOL;
    foreach ($v->errors() as $message)
    {
        echo $message, PHP_EOL;
    }
}
```

### Available rules

[](#available-rules)

##### required

[](#required)

The value must be not empty.

##### in:1,2,3

[](#in123)

The value should equals 1, 2 or 3.

##### email

[](#email)

The value should be a valid email address.

##### notin:1, 2, 3

[](#notin1-2-3)

The value should not equals 1, 2 or 3.

##### min:3

[](#min3)

The value should be at least 3 characters long.

##### max:30

[](#max30)

The value should be at most 30 characters long.

##### len:30

[](#len30)

The value should be exact 30 characters long.

##### min\_value:3

[](#min_value3)

The value should equal or greater than 3.

##### max\_value:30

[](#max_value30)

The value should equal or smaller than 30.

##### matches:anotherField

[](#matchesanotherfield)

The value should equal with the value of another registered field.

##### is:someValue

[](#issomevalue)

The value should equals the value at parameter 1. (someValue)

##### min\_words:3

[](#min_words3)

The value should contain at least 3 words.

### License

[](#license)

MIT

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

3683d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9164292?v=4)[Tommy](/maintainers/tyurderi)[@tyurderi](https://github.com/tyurderi)

### Embed Badge

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

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

###  Alternatives

[chaoswey/taiwan-id-validator

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

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

PHPackages © 2026

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