PHPackages                             caridea/validate - 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. caridea/validate

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

caridea/validate
================

A shrimp of a validation library

3.0.0(8y ago)05732Apache-2.0PHPPHP &gt;=7.1.0

Since Mar 22Pushed 8y ago2 watchersCompare

[ Source](https://github.com/libreworks/caridea-validate)[ Packagist](https://packagist.org/packages/caridea/validate)[ Docs](http://github.com/libreworks/caridea-validate)[ RSS](/packages/caridea-validate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (8)Used By (2)

caridea-validate
================

[](#caridea-validate)

Caridea is a miniscule PHP application library. This shrimpy fellow is what you'd use when you just want some helping hands and not a full-blown framework.

[![](https://camo.githubusercontent.com/3a9d2bd9abd336c1541d254cd07f8dff935288ad4a0983294f0b3f572f5b0f4b/687474703a2f2f6c69627265776f726b732e636f6d2f636172696465612d3130302e706e67)](https://camo.githubusercontent.com/3a9d2bd9abd336c1541d254cd07f8dff935288ad4a0983294f0b3f572f5b0f4b/687474703a2f2f6c69627265776f726b732e636f6d2f636172696465612d3130302e706e67)

This is its validation library.

It supports [LIVR rules](https://github.com/koorchik/LIVR) with some exceptions. See the Compliance → *LIVR* section below.

[![Packagist](https://camo.githubusercontent.com/799c6294a190e0806867bdfcbd0e8e73f57671ea71baeaa4304942e26c02cb9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636172696465612f76616c69646174652e737667)](https://packagist.org/packages/caridea/validate)[![Build Status](https://camo.githubusercontent.com/ba0b04a24a8aa9b5e69bc38c603aa13929a742f820cacf173471e51290e39e24/68747470733a2f2f7472617669732d63692e6f72672f6c69627265776f726b732f636172696465612d76616c69646174652e737667)](https://travis-ci.org/libreworks/caridea-validate)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/eb84f5eca3883cc2f77a35247beedaff2b5f78bc1e3930ed44c7e27bc8e93d25/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c69627265776f726b732f636172696465612d76616c69646174652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/libreworks/caridea-validate/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/cef91fdde494e3bde7a9691632ea31d0b8af78bdbfab2b87feaddb71a80c1cee/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c69627265776f726b732f636172696465612d76616c69646174652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/libreworks/caridea-validate/?branch=master)[![Documentation Status](https://camo.githubusercontent.com/d79195f5fa310396fdc1a60e47ea131055e894184bcb85d9c109c0f2ba23f452/687474703a2f2f72656164746865646f63732e6f72672f70726f6a656374732f636172696465612d76616c69646174652f62616467652f3f76657273696f6e3d6c6174657374)](http://caridea-validate.readthedocs.io/en/latest/?badge=latest)

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

[](#installation)

You can install this library using Composer:

```
$ composer require caridea/validate
```

- The master branch (version 3.x) of this project requires PHP 7.1 and has no dependencies.
- Version 2.x of this project requires PHP 7.0 and has no dependencies.
- Version 1.x of this project requires PHP 5.5 and has no dependencies.

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

[](#documentation)

- Head over to [Read the Docs](http://caridea-validate.readthedocs.io/en/latest/)

Compliance
----------

[](#compliance)

Releases of this library will conform to [Semantic Versioning](http://semver.org).

Our code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), and [PSR-4](http://www.php-fig.org/psr/psr-4/). If you find any issues related to standards compliance, please send a pull request!

### LIVR

[](#livr)

We fully support the JSON rule format as defined by the LIVR spec. However, we do not support the v0.4 style declaration for the `one_of` and `list_of` rules.

For the most part, we support all rules and their return codes as defined by version 2.0 of the specification with some notable exceptions. We did not implement the following rules:

- `trim` – This is part of filtering, not validation.
- `to_lc` – This is part of filtering, not validation.
- `to_uc` – This is part of filtering, not validation.
- `remove` – This is part of filtering, not validation.
- `leave_only` – This is part of filtering, not validation.
- `default` – This is part of filtering, not validation.
- `or` – This is experimental.

We now support alias definitions!

We did add an extra validator: `timezone`! It gives the error `WRONG_TIMEZONE` if the string provided isn't a valid timezone identifier.

Examples
--------

[](#examples)

To create a validator from a rule set, you can pass the definitions to the builder, or you can use the builder procedurally.

```
// rules.json
{
    "name": "required",
    "email": ["required", "email"],
    "drinks": { "one_of": [["coffee", "tea"]] },
    "phone": {"max_length": 10},
}
```

```
$registry = new \Caridea\Filter\Registry();
$builder = $registry->builder();
$ruleset = json_decode(file_get_contents('rules.json'));
$validator = $builder->build($ruleset);
```

```
$registry = new \Caridea\Filter\Registry();
$builder = $registry->builder();
$validator = $builder->field('name', 'required')
    ->field('email', 'required', 'email')
    ->field('drinks', ['one_of' => [['coffee', 'tea']]])
    ->field('phone', ['max_length' => 10])
    ->build();
```

You can either inspect the validation results, or throw an exception containing any errors.

```
$input = [
    'foo' => 'bar',
    'abc' => '123',
];
$result = $validator->validate($input);
// or
$validator->assert($input);
```

You can register your own custom rules in the `Registry`.

```
$registry = new \Caridea\Validate\Registry();
$registry->register([
    'credit_card' => ['MyCustomRules', 'getCreditCard'], // a static method
]);
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~168 days

Total

7

Last Release

3032d ago

Major Versions

1.x-dev → 2.0.02016-03-27

2.1.x-dev → 3.0.02018-01-28

PHP version history (3 changes)1.0.0PHP &gt;=5.5.0

2.0.0PHP &gt;=7.0.0

3.0.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/659262eac941ffe4795493834425fc9a2369c2c9df3cc565ed4194f1d37be934?d=identicon)[doublecompile](/maintainers/doublecompile)

---

Top Contributors

[![doublecompile](https://avatars.githubusercontent.com/u/4267230?v=4)](https://github.com/doublecompile "doublecompile (21 commits)")

---

Tags

validationvalidatelivr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/caridea-validate/health.svg)

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

###  Alternatives

[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)[inhere/php-validate

generic data validate, filter library of the php

26787.4k13](/packages/inhere-php-validate)[sadegh19b/laravel-persian-validation

A comprehensive Laravel validation package for Persian text, numbers, dates, and Iranian national identifiers

18293.8k1](/packages/sadegh19b-laravel-persian-validation)[awurth/slim-validation

A wrapper around the respect/validation PHP validation library for easier error handling and display

65378.4k9](/packages/awurth-slim-validation)[bartosz-maciaszek/validation

Validation library for PHP 5.6+ / HHVM inspired by Joi.

3223.3k](/packages/bartosz-maciaszek-validation)[czim/laravel-dataobject

Basic validatable standardized data object.

11137.7k7](/packages/czim-laravel-dataobject)

PHPackages © 2026

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