PHPackages                             inani/phpvalidate - 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. inani/phpvalidate

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

inani/phpvalidate
=================

The lightest way to validate your inputs.

1.0(6y ago)1161[1 PRs](https://github.com/akiyamaSM/PHPValidate/pulls)MITPHPCI passing

Since Feb 25Pushed 4w ago1 watchersCompare

[ Source](https://github.com/akiyamaSM/PHPValidate)[ Packagist](https://packagist.org/packages/inani/phpvalidate)[ RSS](/packages/inani-phpvalidate/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

Welcome to PHPValidate!
=======================

[](#welcome-to-phpvalidate)

You have some input data to validate but you don't want to grab the huge libraries to validate them? Well here is the solution, PHPValidate is a very light libraries that allows you to validate simple data and enables you to create custom constraint at any time! Come on give it a try!

Installation
============

[](#installation)

```
composer require inani/phpvalidate
```

Usage
=====

[](#usage)

Feed the **Validator** with the array data to verifies

```
$validator = new Validator([  'name' => 'Inani El Houssain']);
```

Build your Rules

```
// Only if required and without length greater or equal than 10 characters
$validator->addRule(( new Rule('name'))->required()->min(10));
```

Check the rules

```
$bool = $validator->check();
```

Get the errors list

```
// get the errors of the name field, all the fields if not specified
$validator->getErrors('name');
```

Available rules
===============

[](#available-rules)

ruleREADMErequiredField not emptyminThe minimum charactersmaxThe maximum number of charactersnumberthe input should be a numeric valueCustom Constraints
==================

[](#custom-constraints)

Every custom rule should extends the **CustomConstraint** Class and implements the two methods, for instance creating a rule that validates an email field:

```
