PHPackages                             ej3dev/veritas - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. ej3dev/veritas

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

ej3dev/veritas
==============

A pragmatic and concise validation library written in PHP

v0.6.0(12y ago)219MITPHPPHP &gt;=5.3.0

Since May 8Pushed 12y ago1 watchersCompare

[ Source](https://github.com/ej3dev/Veritas)[ Packagist](https://packagist.org/packages/ej3dev/veritas)[ Docs](https://github.com/ej3dev/Veritas)[ RSS](/packages/ej3dev-veritas/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

ej3dev\\Veritas
===============

[](#ej3devveritas)

[![Latest Stable Version](https://camo.githubusercontent.com/93ac2b45ae384e5fc7acaa6adece1b778cf64736ee1511a507e76f8df122e2b6/68747470733a2f2f706f7365722e707567782e6f72672f656a336465762f766572697461732f762f737461626c652e706e67)](https://packagist.org/packages/ej3dev/veritas) [![Total Downloads](https://camo.githubusercontent.com/ecb5429939d58655c26d9ef320e6daebdea8a653b1bec64f5dc797703df06092/68747470733a2f2f706f7365722e707567782e6f72672f656a336465762f766572697461732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/ej3dev/veritas) [![Latest Unstable Version](https://camo.githubusercontent.com/3293e2b62cddf27a899b7f25eb7f3acff5d3eceb4666d585860d277478718080/68747470733a2f2f706f7365722e707567782e6f72672f656a336465762f766572697461732f762f756e737461626c652e706e67)](https://packagist.org/packages/ej3dev/veritas) [![License](https://camo.githubusercontent.com/3c7012f6fac4761ea5e735f4a82b9f2c85ad864e0d5d16e4996e88235aa86fa3/68747470733a2f2f706f7365722e707567782e6f72672f656a336465762f766572697461732f6c6963656e73652e706e67)](https://packagist.org/packages/ej3dev/veritas)

A pragmatic and concise validation library written in PHP.

The idea behind [**Veritas**](http://en.wikipedia.org/wiki/Veritas) is implement a flexible easy to use validation engine so you can write validation code as easy as you can build questions in everyday language.

```
// Is $var a decimal value in the interval [-1,1]?
v::is($var)->dec()->in('[-1,1]')->verify();

// Is $var an array with a index 8 with value 'eight'?
v::is($var)->arr()->key(8,'eight')->verify();

// Is $var a string that represent a date in format year-month-day?
v::is($var)->str()->date('Y-m-d')->verify();

// Is $var an object with a property called 'name'?
v::is($var)->obj()->attr('name')->verify();

//Is $mail a valid email address from Gmail or Yahoo?
v:isEmail($mail)->contains('@gmail','@yahoo')->verify();
```

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

[](#requirements)

**Veritas** requires PHP 5.3 or later.

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

[](#installation)

**Veritas** is a *one-file-project* with *zero dependencies* available on [GitHub](https://github.com/ej3dev/Veritas) and [Packagist](https://packagist.org/packages/ej3dev/veritas). You have two options to install it:

### Composer

[](#composer)

Use [Composer](https://getcomposer.org) dependency Manager for PHP. Add the following to your `composer.json` and run `composer update`.

```
"require": {
    "ej3dev/veritas": "~0.6"
}
```

### Single file require

[](#single-file-require)

Download the project package, find the file `Verifier.php` and copy it wherever you want in your project working directory. Then use `require_one` to include the file in your code:

```
require_once('path/to/Verifier.php');
```

Use
---

[](#use)

### Composer autoload or single file require

[](#composer-autoload-or-single-file-require)

**Veritas** support *PSR-4 autoloading* via [Composer](https://getcomposer.org). Import third party code to your context with [Composer autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
