PHPackages                             albert221/validation - 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. albert221/validation

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

albert221/validation
====================

Simple validator

v1.1.1(8y ago)152231[1 issues](https://github.com/Albert221/validation/issues)MITPHPPHP &gt;=5.6

Since Dec 6Pushed 8y ago3 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Basic validator
===============

[](#basic-validator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c08248a13cafda3bdf6c798d674cb28ef1504050284444b8346ae95e8e1d26a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c626572743232312f76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/albert221/validation)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/12e454ebc397241e8fc18bd607a2f634ed7a1fc78952b82bf76682ad00847b99/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f416c626572743232312f76616c69646174696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Albert221/validation)[![Coverage Status](https://camo.githubusercontent.com/84cadd387e3e6be8536715d4d56c4368ca6241cadace2026c55ff20ee8613ac5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f616c626572743232312f76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/albert221/validation/code-structure)[![Quality Score](https://camo.githubusercontent.com/ab70a017f2c2593962bb8331730ef2325b50da65a16354185beb75a8bbd54d16/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616c626572743232312f76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/albert221/validation)[![Total Downloads](https://camo.githubusercontent.com/1ad3251465f3eecaa64b6062796010bdefdbe93b64a27891a9ea6d3cf3ea8e3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c626572743232312f76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/albert221/validation)

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

[](#installation)

Via Composer

```
composer require albert221/validation ^2.0
```

Usage
-----

[](#usage)

```
use Albert221\Validation\Validator;
use Albert221\Validation\Rule;

// $data = [...];

$verdicts = Validator::build()
    ->addField('username')
        ->addRule(Rule\Required::class)
        ->addRule(Rule\Length::class, ['min' => 4])
        ->addRule(Rule\PdoUnique::class, ['pdo' => $pdo, 'table' => 'users', 'field' => 'username'])
    ->addField('email')
        ->addRule(Rule\Required::class)
        ->addRule(Rule\Email::class)
        ->addRule(Rule\PdoUnique::class, ['pdo' => $pdo, 'table' => 'users', 'field' => 'email'])
    ->addField('password')
        ->addRule(Rule\Required::class)
        ->addRule(Rule\Length::class)
            ->setOption('min', 6) // You can set options that way, too!
        ->addRule(Rule\Complexity::class, ['alpha' => true, 'num' => true, 'special' => true])
            ->setMessage('Your password is too weak!')
    ->addField('confirm_password')
        ->addRule(Rule\SameAs::class, ['field' => 'password']
    ->validate($data);

if ($verdicts->fails()) {
    // Validation failed
}

// Validation passed

# Other methods

$verdicts->passes(); // Is valid?
$verdicts->forField('username'); // Get all verdicts for specified field.
$verdicts->forField('username')->passes(); // Is specified field valid?
$verdicts->toArray(); // Get all verdicts as an array.
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3082d ago

Major Versions

v1.1.1 → v2.0-beta12017-12-06

PHP version history (2 changes)v1.1.1PHP &gt;=5.6

v2.0-beta1PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6d5793e40e8c4dd15725d657cf6d6d7cb6bbee27dbf2bae2c84c89a3c656dd7?d=identicon)[Albert221](/maintainers/Albert221)

---

Top Contributors

[![Albert221](https://avatars.githubusercontent.com/u/4085280?v=4)](https://github.com/Albert221 "Albert221 (66 commits)")

---

Tags

validationvalidator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/albert221-validation/health.svg)

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

###  Alternatives

[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[laminas/laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

15544.9M188](/packages/laminas-laminas-validator)

PHPackages © 2026

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