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

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

particle/validator
==================

Flexible and highly usable validation library with no dependencies.

v2.3.6(5mo ago)2521.7M↓14.6%40[12 issues](https://github.com/particle-php/Validator/issues)[3 PRs](https://github.com/particle-php/Validator/pulls)10BSD-3-ClausePHPPHP &gt;=5.4

Since Mar 31Pushed 5mo ago11 watchersCompare

[ Source](https://github.com/particle-php/Validator)[ Packagist](https://packagist.org/packages/particle/validator)[ Docs](http://github.com/particle-php/validator)[ RSS](/packages/particle-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (30)Used By (10)

[![image](https://cloud.githubusercontent.com/assets/6495166/7207286/8b48105e-e538-11e4-9dfa-97c7fb2398aa.png)](http://validator.particle-php.com)
==================================================================================================================================================

[](#)

[![Travis-CI](https://camo.githubusercontent.com/936763316fd0430f8f4308a761e899169cc8e7cfa7561e1d51da3f2bdbf3b2a2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7061727469636c652d7068702f56616c696461746f722f6d61737465722e737667)](https://travis-ci.org/particle-php/Validator)[![Packagist](https://camo.githubusercontent.com/ce691c64f413dff6bd8ec5d86dc6c1f2cc51a0cab59822a9f019cb96d689b2d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061727469636c652f76616c696461746f722e737667)](https://packagist.org/packages/particle/validator)[![Packagist downloads](https://camo.githubusercontent.com/aae72b02b38c5a81bf70c2e070e2dc1f50b291de79e9b70f6eff5c390c9d1cfb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061727469636c652f76616c696461746f722e737667)](https://packagist.org/packages/particle/validator)[![Scrutinizer](https://camo.githubusercontent.com/a426f53b85fcaed822867a75507727478f677727e7ec8eac2b361713c0a6465b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7061727469636c652d7068702f56616c696461746f722e737667)](https://scrutinizer-ci.com/g/particle-php/Validator/?branch=master)[![Scrutinizer](https://camo.githubusercontent.com/fef9615ff4936fd2ed8f76ec0f7d34f71a4c5debe6b2285d9d88d6d6600d4923/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7061727469636c652d7068702f56616c696461746f722f6d61737465722e737667)](https://scrutinizer-ci.com/g/particle-php/Validator/?branch=master)

*Particle\\Validator* is a very small validation library, with the easiest and most usable API we could possibly create.

Install
-------

[](#install)

To easily include *Particle\\Validator* into your project, install it via [composer](https://getcomposer.org) using the command line:

```
composer require particle/validator
```

Small usage example
-------------------

[](#small-usage-example)

```
use Particle\Validator\Validator;

$v = new Validator;

$v->required('user.first_name')->lengthBetween(2, 50)->alpha();
$v->required('user.last_name')->lengthBetween(2, 50)->alpha();
$v->required('newsletter')->bool();

$result = $v->validate([
    'user' => [
        'first_name' => 'John',
        'last_name' => 'D',
    ],
    'newsletter' => true,
]);

$result->isValid(); // bool(false).
$result->getMessages();
/**
 * array(1) {
 *     ["user.last_name"]=> array(1) {
 *         ["Length::TOO_SHORT"]=> string(53) "last_name is too short and must be 2 characters long."
 *     }
 * }
 */
```

Functional features
-------------------

[](#functional-features)

- Validate an array of data
- Get an array of error messages
- Overwrite the default error messages on rules, or error messages on specific values
- Get the validated values of an array
- Validate different contexts (insert, update, etc.) inheriting validations of the default context
- [A large set of default validation rules](http://validator.particle-php.com/en/latest/rules/)
- Ability to extend the validator to add your own custom rules

Non functional features
-----------------------

[](#non-functional-features)

- Easy to write (IDE auto-completion for easy development)
- Easy to read (improves peer review)
- Ability to separate controller and view logic
- Fully documented: [validator.particle-php.com](http://validator.particle-php.com)
- Fully tested: [Scrutinizer](https://scrutinizer-ci.com/g/particle-php/Validator/)
- Zero dependencies

===

Find more information and advanced usage examples at [validator.particle-php.com](http://validator.particle-php.com)

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance71

Regular maintenance activity

Popularity60

Solid adoption and visibility

Community36

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 51.3% 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 ~139 days

Recently: every ~632 days

Total

29

Last Release

160d ago

Major Versions

v0.4.2 → v1.0.02015-05-31

v1.0.5 → 2.0.0-alpha.12015-08-26

v1.0.6 → v2.0.02015-10-30

v1.0.x-dev → v2.3.42019-01-07

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.2

2.0.0-alpha.1PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6169c8b4657a79f3a96b4f167abc794d76402db6e4c0ad4bfe0c9b71fa8b2ef1?d=identicon)[berry\_\_](/maintainers/berry__)

![](https://www.gravatar.com/avatar/8517df511923178ac5c36f913626d23a678563d2af6219bd77c46f3b5466c794?d=identicon)[RickvdStaaij](/maintainers/RickvdStaaij)

---

Top Contributors

[![berry-langerak](https://avatars.githubusercontent.com/u/203825?v=4)](https://github.com/berry-langerak "berry-langerak (61 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (20 commits)")[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (7 commits)")[![skoop](https://avatars.githubusercontent.com/u/90003?v=4)](https://github.com/skoop "skoop (6 commits)")[![vova07](https://avatars.githubusercontent.com/u/2714082?v=4)](https://github.com/vova07 "vova07 (4 commits)")[![NickBelhomme](https://avatars.githubusercontent.com/u/312003?v=4)](https://github.com/NickBelhomme "NickBelhomme (4 commits)")[![camcima](https://avatars.githubusercontent.com/u/1918601?v=4)](https://github.com/camcima "camcima (3 commits)")[![rtuin](https://avatars.githubusercontent.com/u/360150?v=4)](https://github.com/rtuin "rtuin (3 commits)")[![schnittstabil](https://avatars.githubusercontent.com/u/6059032?v=4)](https://github.com/schnittstabil "schnittstabil (2 commits)")[![noahlemen](https://avatars.githubusercontent.com/u/5393571?v=4)](https://github.com/noahlemen "noahlemen (1 commits)")[![rcatlin](https://avatars.githubusercontent.com/u/1914706?v=4)](https://github.com/rcatlin "rcatlin (1 commits)")[![RobQuistNL](https://avatars.githubusercontent.com/u/1442796?v=4)](https://github.com/RobQuistNL "RobQuistNL (1 commits)")[![bradymiller](https://avatars.githubusercontent.com/u/278968?v=4)](https://github.com/bradymiller "bradymiller (1 commits)")[![stephenwaite](https://avatars.githubusercontent.com/u/5618372?v=4)](https://github.com/stephenwaite "stephenwaite (1 commits)")[![jaytaph](https://avatars.githubusercontent.com/u/241458?v=4)](https://github.com/jaytaph "jaytaph (1 commits)")[![jaapverloop](https://avatars.githubusercontent.com/u/599294?v=4)](https://github.com/jaapverloop "jaapverloop (1 commits)")[![lguima](https://avatars.githubusercontent.com/u/1562097?v=4)](https://github.com/lguima "lguima (1 commits)")[![adriansuter](https://avatars.githubusercontent.com/u/3974990?v=4)](https://github.com/adriansuter "adriansuter (1 commits)")

---

Tags

validatorvalidation

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[opis/json-schema

Json Schema Validator for PHP

64736.9M186](/packages/opis-json-schema)[vlucas/valitron

Simple, elegant, stand-alone validation library with NO dependencies

1.6k4.4M128](/packages/vlucas-valitron)[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[wixel/gump

A fast, extensible &amp; stand-alone PHP input validation class that allows you to validate any data.

1.2k1.3M30](/packages/wixel-gump)

PHPackages © 2026

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