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

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

rossriley/validation
====================

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules. This fork maintains PHP 5.3 compatibility.

1.2.1(11y ago)218.3k11MITPHPPHP &gt;=5.3

Since Mar 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/rossriley/validation)[ Packagist](https://packagist.org/packages/rossriley/validation)[ RSS](/packages/rossriley-validation/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (4)Used By (1)

\#Sirius Validation

[![Build Status](https://camo.githubusercontent.com/ff1d0ff58a73d0a14f765e1dbfe30e16d31b3b4a872a9dddd77d2b842e63a519/68747470733a2f2f7472617669732d63692e6f72672f7369726975737068702f76616c69646174696f6e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/siriusphp/validation)[![Coverage Status](https://camo.githubusercontent.com/42042c5bd4ef39f85452f46cee8a15ca0bdb7d8191c0cbee93ed3db354d83225/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7369726975737068702f76616c69646174696f6e2f62616467652e706e67)](https://coveralls.io/r/siriusphp/validation)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a04e6e889ddca9b3ba619678ea7f1b66a6146764e9bd00711cf8bd1cef0102c7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7369726975737068702f76616c69646174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f733d39656537373739623262663735616165366332366264356630623661393061393038316232353435)](https://scrutinizer-ci.com/g/siriusphp/validation/)[![Latest Stable Version](https://camo.githubusercontent.com/dadfcf83c2ac19a33b2d3548742d28c3b0f74a2190faf6952daed8c7815acfb7/68747470733a2f2f706f7365722e707567782e6f72672f7369726975737068702f76616c69646174696f6e2f762f737461626c652e706e67)](https://packagist.org/packages/siriusphp/validation)[![License](https://camo.githubusercontent.com/8090f03ffc59b852c244871103ef158950066b7ba45176043073004506fff0b9/68747470733a2f2f706f7365722e707567782e6f72672f7369726975737068702f76616c69646174696f6e2f6c6963656e73652e706e67)](https://packagist.org/packages/siriusphp/validation)

Sirius Validation is a library for data validation. It offers:

1. [validator object](docs/validator.md) to validate arrays, `ArrayObjects` or objects that have a `toArray` method. It can be extended easily to validate other types.
2. [value validator object](docs/value_validator.md) to validate single values
3. [validation helper](docs/helper.md) to simplify single value validation (does not generate error messages, only returns TRUE/FALSE)
4. [build-in validation rules](docs/rules.md) to perform the actual data validation. The validation rules are used by the helper and validator objects.

Out-of-the-box, the library can handle `array`s, `ArrayObject`s and objects that have implemented the `toArray` method. In order to validate other data containers you must create a [`DataWrapper`](https://github.com/siriusphp/validation/blob/master/src/Validation/DataWrapper/WrapperInterface.php) so that the validator be able to extract data from your object.

\##Elevator pitch

```
$validation = new \Sirius\Validation\Validator;

// add a validation rule
$validator->add('title', 'required');

// add a rule that has a list of options
$validator->add('title', 'maxlength', array('max' => 100));
// or use JSON
$validator->add('title', 'maxlength', '{"max": 100}');
// or a URL query string
$validator->add('title', 'maxlength', 'max=100');

// add a rule with a custom error message
$validator->add('title', 'maxlength', 'max=100', 'Article title must have less than {max} characters');

// add a rule with a custom message and a label (very handy with forms)
$validator->add('title', 'maxlength', 'max=100', '{label} must have less than {max} characters', 'Title');

// add all of rule's configuration in a string (you'll see later why it's handy')
$validator->add('title', 'maxlength(max=255)({label} must have less than {max} characters)(Title)');

// add multiple rules at once (separate using [space][pipe][space])
$validator->add('title', 'required | maxlength(max=255) | minlength(min=10)');

// add all your rules at once
$validator->add(array(
    'title' => 'required | maxlength(max=10)({label} must have less than {max} characters)(Title)',
	'content' => 'required',
	'source' => 'website'
));

// add nested rules
$validator->add('recipients[*]', 'email'); //all recipients must be valid email addresses
$validator->add('shipping_address[city]', 'MyApp\Validator\City'); // uses a custom validator to validate the shipping city
```

\##Documentation

[go to the documentation](docs/index.md)

Release notes
-------------

[](#release-notes)

#### 1.1

[](#11)

- Added HHVM to Travis CI
- Renamed Validator\* classes into Rule\* classes (breaking change if you used custom rule classes)
- Renamed ValidatorFactory to RuleFactory (breaking change)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 83.6% 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 ~46 days

Total

3

Last Release

4347d ago

PHP version history (2 changes)1.1.0PHP &gt;=5.4

1.2.1PHP &gt;=5.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5082?v=4)[Ross Riley](/maintainers/rossriley)[@rossriley](https://github.com/rossriley)

---

Top Contributors

[![adrianmiu](https://avatars.githubusercontent.com/u/1293017?v=4)](https://github.com/adrianmiu "adrianmiu (51 commits)")[![rossriley](https://avatars.githubusercontent.com/u/5082?v=4)](https://github.com/rossriley "rossriley (5 commits)")[![gajus](https://avatars.githubusercontent.com/u/973543?v=4)](https://github.com/gajus "gajus (4 commits)")[![bradchesney79](https://avatars.githubusercontent.com/u/306802?v=4)](https://github.com/bradchesney79 "bradchesney79 (1 commits)")

---

Tags

validationsecurityformsanitizationmodeling

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[siriusphp/validation

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

181743.3k13](/packages/siriusphp-validation)[progsmile/request-validator

Simple PHP Request Validator

33113.3k1](/packages/progsmile-request-validator)[apy/jsfv-bundle

Symfony2 Javascript Form Validation Bundle with localisation support

92770.5k](/packages/apy-jsfv-bundle)[arondeparon/laravel-request-sanitizer

An easy to use request sanitizer that allows you to sanitize your form data before validating it.

112151.6k1](/packages/arondeparon-laravel-request-sanitizer)[olssonm/l5-zxcvbn

Implementation of the zxcvbn project by @dropbox for Laravel. Uses zxcvbn-php by @bjeavons.

28311.1k1](/packages/olssonm-l5-zxcvbn)[stroker/form

ZF2 module for extending forms with live clientside validation

4157.1k](/packages/stroker-form)

PHPackages © 2026

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