PHPackages                             seorc/phpiv - 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. seorc/phpiv

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

seorc/phpiv
===========

A simple PHP input validation toolset.

v0.3.0(9y ago)0979MITPHP

Since Jun 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/seorc/phpiv)[ Packagist](https://packagist.org/packages/seorc/phpiv)[ RSS](/packages/seorc-phpiv/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

PHP Input Validator
===================

[](#php-input-validator)

This is a really-small PHP validator which is intended to offer a easy-to-use interface and some mechanisms to integrate with other tools. Here is how it works:

1. Create an associative array of values.
2. Create a validator for each of the values in that array. The preferred way of doing this is by grouping all your validators in a ValidatiorSet.
3. Apply the ValidatorSet to the array. A ValidationError will tel you that one or more fields in the array are not valid according to the rules you had defined.
4. Obtain the set of errors associated to their corresponding field by calling ValidationError::getErrors() on the exception instance you catched.

Please, see the tests to get some hints on how to make this in work in code. I plan to add some parctical examples to this docs in future commits.

The design of this validator imitates what other frameworks do. I created it to have a simple validation tool-belt for small projects and for fun.

Simple example:

```
