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

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

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

4.0.0(2y ago)180773.7k—1.9%29[1 issues](https://github.com/siriusphp/validation/issues)[1 PRs](https://github.com/siriusphp/validation/pulls)13MITPHPPHP &gt;=8.0CI failing

Since Mar 22Pushed 2y ago9 watchersCompare

[ Source](https://github.com/siriusphp/validation)[ Packagist](https://packagist.org/packages/siriusphp/validation)[ RSS](/packages/siriusphp-validation/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (3)Versions (25)Used By (13)

Sirius Validation
=================

[](#sirius-validation)

[![Source Code](https://camo.githubusercontent.com/b0ff73110860f752cf0785f6d23e61e5e200c5a1f5531f6a99e94d52eeda8208/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d7369726975737068702f76616c69646174696f6e2d626c75652e737667)](https://github.com/siriusphp/validation)[![Latest Version](https://camo.githubusercontent.com/6d0036b659604966ac084194dc8ac332e72ad4d865b2796baf5d9887d4b567d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369726975737068702f76616c69646174696f6e2e737667)](https://github.com/siriusphp/validation/releases)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](https://github.com/siriusphp/validation/blob/master/LICENSE)[![Build Status](https://github.com/siriusphp/validation/workflows/CI/badge.svg)](https://github.com/siriusphp/validation/actions)[![Coverage Status](https://camo.githubusercontent.com/02c8b1f4f84765cdce5d4691bec204059563bb6cfb1066be3d3f376751790bf2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7369726975737068702f76616c69646174696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/siriusphp/validation/code-structure)[![Quality Score](https://camo.githubusercontent.com/07dfc8200cc931acf4837ccaac82d7b023d2c030445f8e26e542c7fc9667cf3a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7369726975737068702f76616c69646174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/siriusphp/validation)[![Total Downloads](https://camo.githubusercontent.com/58b85221dbbcdd550470bee16622548a73ee76d3dd0139098617af25d3d3f9e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369726975737068702f76616c69646174696f6e2e737667)](https://packagist.org/packages/siriusphp/validation)

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

1. [validator object](docs/validator.md)
2. [45 build-in validation rules](docs/validation_rules.md). There are validators for strings, array, numbers, emails, URLs, files and uploads
3. [validation helper](docs/helper.md) to simplify the validation of single values

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
--------------

[](#elevator-pitch)

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

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

// add a rule that has a list of options
$validator->add('title', 'length', array('min' => 10, 'max' => 100));
// or use JSON
$validator->add('title', 'length', '{"min": 10, "max": 100}');
// or a URL query string
$validator->add('title', 'length', 'min=10&max=100');
// or, if you know that the validator can CORECTLY parse (ie: understand) the options string
$validator->add('title', 'length', '10,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:Title', 'maxlength', 'max=100', '{label} must have less than {max} characters');

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

// add all your rules at once
$validator->add([
        'title:Title' => 'required | maxlength(100)',
        'content:Content' => 'required',
        'source:Source' => 'website'
    ], [
        'content.required' => 'The content field should have a velue'
    ]);

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

Links
-----

[](#links)

- [documentation](http://sirius.ro/php/sirius/validation/)
- [changelog](CHANGELOG.md)

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 69% 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 ~168 days

Recently: every ~340 days

Total

22

Last Release

958d ago

Major Versions

1.2.5 → 2.0.02015-05-17

2.3.0 → 3.0.02020-02-27

3.1.0 → 4.0.02023-11-19

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

1.2.2PHP &gt;=5.3

3.0.0PHP &gt;=7.1

4.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![adrianmiu](https://avatars.githubusercontent.com/u/1293017?v=4)](https://github.com/adrianmiu "adrianmiu (100 commits)")[![eclipxe13](https://avatars.githubusercontent.com/u/1266852?v=4)](https://github.com/eclipxe13 "eclipxe13 (13 commits)")[![sergiobelya](https://avatars.githubusercontent.com/u/6141086?v=4)](https://github.com/sergiobelya "sergiobelya (7 commits)")[![Rhilip](https://avatars.githubusercontent.com/u/13842140?v=4)](https://github.com/Rhilip "Rhilip (6 commits)")[![gajus](https://avatars.githubusercontent.com/u/973543?v=4)](https://github.com/gajus "gajus (4 commits)")[![kenjis](https://avatars.githubusercontent.com/u/87955?v=4)](https://github.com/kenjis "kenjis (3 commits)")[![filisko](https://avatars.githubusercontent.com/u/8798694?v=4)](https://github.com/filisko "filisko (1 commits)")[![everon](https://avatars.githubusercontent.com/u/375251?v=4)](https://github.com/everon "everon (1 commits)")[![gumacs92](https://avatars.githubusercontent.com/u/12608260?v=4)](https://github.com/gumacs92 "gumacs92 (1 commits)")[![bradchesney79](https://avatars.githubusercontent.com/u/306802?v=4)](https://github.com/bradchesney79 "bradchesney79 (1 commits)")[![kulavvy](https://avatars.githubusercontent.com/u/47749939?v=4)](https://github.com/kulavvy "kulavvy (1 commits)")[![mickrip](https://avatars.githubusercontent.com/u/320334?v=4)](https://github.com/mickrip "mickrip (1 commits)")[![nanawel](https://avatars.githubusercontent.com/u/4866761?v=4)](https://github.com/nanawel "nanawel (1 commits)")[![bokunodev](https://avatars.githubusercontent.com/u/54968427?v=4)](https://github.com/bokunodev "bokunodev (1 commits)")[![amirkhiz](https://avatars.githubusercontent.com/u/8492686?v=4)](https://github.com/amirkhiz "amirkhiz (1 commits)")[![Tichael](https://avatars.githubusercontent.com/u/13114338?v=4)](https://github.com/Tichael "Tichael (1 commits)")[![userlond](https://avatars.githubusercontent.com/u/7788670?v=4)](https://github.com/userlond "userlond (1 commits)")[![vikkio88](https://avatars.githubusercontent.com/u/248805?v=4)](https://github.com/vikkio88 "vikkio88 (1 commits)")

---

Tags

formsinputphpsanitizationsecurityvalidationvalidationsecurityformsanitizationmodeling

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[progsmile/request-validator

Simple PHP Request Validator

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

Symfony2 Javascript Form Validation Bundle with localisation support

92773.7k](/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.

112160.9k4](/packages/arondeparon-laravel-request-sanitizer)[olssonm/l5-zxcvbn

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

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

ZF2 module for extending forms with live clientside validation

3957.1k](/packages/stroker-form)

PHPackages © 2026

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