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

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

mooti/validator
===============

PHP validator for json style data structures

2.4.0(6y ago)312.4k2[4 PRs](https://github.com/mooti/validator/pulls)2Apache-2.0PHPPHP &gt;=7.0.0

Since Apr 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mooti/validator)[ Packagist](https://packagist.org/packages/mooti/validator)[ RSS](/packages/mooti-validator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (3)Versions (25)Used By (2)

Mooti Validator
===============

[](#mooti-validator)

[![Build Status](https://camo.githubusercontent.com/f7f4420ac14310a6b04f4481c00c57efaa6bba42c1f9876e00c7b16659493e2b/68747470733a2f2f7472617669732d63692e6f72672f6d6f6f74692f76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mooti/validator)[![Coverage Status](https://camo.githubusercontent.com/fa23e58cae2af0a31a80280fe0ada80330c34dea3a59f911e3d7216b67ed1a1c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6f6f74692f76616c696461746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mooti/validator?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/a8b24b7aeca94a424efa7b5e81af9da4523e9f594e4bad76a4e26bd38320de07/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f74692f76616c696461746f722f762f737461626c65)](https://packagist.org/packages/mooti/validator)[![Total Downloads](https://camo.githubusercontent.com/2455ade76219ff622b2ff594457d490249f82ffbc1af5a1dadb60945d5301ca3/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f74692f76616c696461746f722f646f776e6c6f616473)](https://packagist.org/packages/mooti/validator)[![Latest Unstable Version](https://camo.githubusercontent.com/869dc8099eb4ef343d18cb0c397daa0ae5860b4f61823747d62d65e7eae16f58/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f74692f76616c696461746f722f762f756e737461626c65)](https://packagist.org/packages/mooti/validator)[![License](https://camo.githubusercontent.com/76d5b5e8670ddfd36c00928b1598b4521edb7ebd4fa95e08919f0ad0fe7d50cb/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6f74692f76616c696461746f722f6c6963656e7365)](https://packagist.org/packages/mooti/validator)

A standalone validator for json style data structures.

### Installation

[](#installation)

You can install this through packagist

```
$ composer require mooti/validator

```

### Run the tests

[](#run-the-tests)

If you would like to run the tests. Use the following:

```
$ ./vendor/bin/phpunit -c config/phpunit.xml

```

### Usage

[](#usage)

The libray allows you to validate a json style data structure using a set of validation rules. The structure can be an array or a standard object (no other type of object will be validated). A validation rule is an associative array with a key corresponding to the item being validated. An example is:

```
