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

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

solophp/validator
=================

PHP Data Validator

v3.0.1(1mo ago)0148MITPHPPHP ^8.1CI passing

Since Jul 14Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/SoloPHP/Validator)[ Packagist](https://packagist.org/packages/solophp/validator)[ RSS](/packages/solophp-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (20)Used By (0)

Solo Validator
==============

[](#solo-validator)

Lightweight PHP validation library with custom rules and structured errors.

[![Latest Version on Packagist](https://camo.githubusercontent.com/3aa2c4498a7145f951e56c5c2a6af9befb2ac038d46bfe06042db1063336a2c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c6f7068702f76616c696461746f722e737667)](https://packagist.org/packages/solophp/validator)[![PHP Version](https://camo.githubusercontent.com/b0b6d5f16e83ecdb2339571189bb6e44a49e79db7b8e5bddf8a9530c7442eb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

Features
--------

[](#features)

- **Built-in Rules** — Required, email, phone, uuid, min, max, length, numeric, date, and more
- **Custom Rules** — Extend validation with your own rules via callbacks
- **Structured Errors** — Machine-readable error objects with rule names and parameters
- **Parameterized Rules** — Define rules like `min:8`, `max:100`, `in:a,b,c`
- **Phone Validation** — International phone validation via libphonenumber
- **Lightweight** — Minimal dependencies, PSR-4 compliant

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

[](#installation)

```
composer require solophp/validator
```

Quick Example
-------------

[](#quick-example)

```
use Solo\Validator\Validator;

$validator = new Validator();

$data = [
    'email' => 'user@example.com',
    'username' => 'john_doe',
    'age' => 25,
];

$rules = [
    'email' => 'required|email',
    'username' => 'required|min:3|max:20',
    'age' => 'integer|min_value:18',
];

$errors = $validator->validate($data, $rules);

if ($validator->fails()) {
    print_r($validator->errors());
    // [
    //     'field' => [
    //         ['rule' => 'email'],
    //         ['rule' => 'min', 'params' => ['3']],
    //     ],
    // ]
} else {
    echo "Validation passed!";
}
```

Documentation
-------------

[](#documentation)

**[Full Documentation](https://solophp.github.io/Validator/)**

- [Installation](https://solophp.github.io/Validator/guide/installation)
- [Quick Start](https://solophp.github.io/Validator/guide/quick-start)
- [Validation Rules](https://solophp.github.io/Validator/features/rules)
- [Custom Rules](https://solophp.github.io/Validator/features/custom-rules)
- [API Reference](https://solophp.github.io/Validator/api/validator)

Requirements
------------

[](#requirements)

- PHP 8.1+

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance90

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

19

Last Release

46d ago

Major Versions

v1.5.0 → v2.0.02025-02-08

v2.7.0 → v3.0.02026-02-17

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f29817cec408d033cd4441c8f760e3ae40248dc0f66856a09080d282aee6959?d=identicon)[Vitaliy Olos](/maintainers/Vitaliy%20Olos)

---

Top Contributors

[![SoloPHP](https://avatars.githubusercontent.com/u/175482616?v=4)](https://github.com/SoloPHP "SoloPHP (31 commits)")

---

Tags

phpvalidatorvalidationdataformForms

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[form-manager/form-manager

PHP-HTML form manager

16041.0k7](/packages/form-manager-form-manager)[progsmile/request-validator

Simple PHP Request Validator

33113.3k1](/packages/progsmile-request-validator)[nilportugues/validator

An efficient data validator for PHP

131.5k](/packages/nilportugues-validator)

PHPackages © 2026

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