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

ActiveLibrary

nikitakiselev/validator
=======================

Simple validation library

06PHP

Since Oct 13Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Validator
=========

[](#validator)

THIS IS ALPHA VERSION.

This is a validation library, like Laravel illuminate\\Validation, but has not a lot of dependencies, and more simpler.

Installation
------------

[](#installation)

```
composer require nikitakiselev/validator dev-master

```

Usage
-----

[](#usage)

```
use NikitaKiselev\Validator\Validator;

$data = [
    'username' => 'required|max:50',
    'email' => 'required|email',
];

$v = new Validator($data, [
    'username' => 'required|max:50',
    'email' => 'required|email',
]);

$v->fails(); // return false
$v->pass(); // return true
$v->errors(); // return []
```

Add custom rules
----------------

[](#add-custom-rules)

For adding your custom rule, you can call `extend` method

```
$v->extend('max', function ($value, $field, $rule, $max) {
    return $value > $max;
});
```

Change message language
-----------------------

[](#change-message-language)

```
$v->setLanguage('ru');
```

Set custom message for validation rule
--------------------------------------

[](#set-custom-message-for-validation-rule)

```
$v->setMessage('required', 'This is custom validation error for "required" rule');
$v->setMessage('username.required', 'This is custom validation error for "required" rule and "username" field');
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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://www.gravatar.com/avatar/04246135f5c0a58ce24d254cb9079548cee3e1ba2b633cad3506276a42180779?d=identicon)[nikitakiselev](/maintainers/nikitakiselev)

---

Top Contributors

[![nikitakiselev](https://avatars.githubusercontent.com/u/2862333?v=4)](https://github.com/nikitakiselev "nikitakiselev (3 commits)")

### Embed Badge

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

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

PHPackages © 2026

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