PHPackages                             hybridlogic/validation - 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. hybridlogic/validation

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

hybridlogic/validation
======================

A simple, extensible validation library for PHP with support for filtering and validating any input array along with generating client side validation code.

v1.0.2(13y ago)641.1k16MITPHPPHP &gt;=5.3.0

Since Jan 5Pushed 11y ago6 watchersCompare

[ Source](https://github.com/Dachande663/PHP-Validation)[ Packagist](https://packagist.org/packages/hybridlogic/validation)[ Docs](https://github.com/Dachande663/PHP-Validation)[ RSS](/packages/hybridlogic-validation/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Validation Library
==================

[](#validation-library)

A simple, extensible validation library for PHP with support for filtering and validating any input array along with generating client side validation code.

[![Build Status](https://camo.githubusercontent.com/6de5d40f880a527fcf8145f9d7c0e1849f513f237e18bb8d7428e1155b32fb9b/68747470733a2f2f7472617669732d63692e6f72672f44616368616e64653636332f5048502d56616c69646174696f6e2e706e67)](https://travis-ci.org/Dachande663/PHP-Validation)

0.0 Table of Contents
---------------------

[](#00-table-of-contents)

- Introduction
- Examples
- Rule Reference
- Running Tests
- Troubleshooting
- Changelog

1.0 Introduction
----------------

[](#10-introduction)

This library provides a simple way to validate an input array against a set of rules. Input could come from $\_POST or any other data source.

Each field can have its own label, pre-filters and rules applied to it. Rules extend a very simple interface, making adding custom rules very easy. The Validator object itself can be executed multiple times against different datasets, making it very useful for processing dynamic data.

Additionally, validation rules can be generated for client side scripts. Currently only jQuery Validate is supplied but additional interfaces can be added easily.

2.0 Examples
------------

[](#20-examples)

```
use HybridLogic\Validation\Validator;
use HybridLogic\Validation\Rule;

$validator = new Validator();
$validator
	->set_label('name', 'first name')
	->set_label('email', 'email address')
	->set_label('password2', 'password confirmation')
	->add_filter('name', 'trim')
	->add_filter('email', 'trim')
	->add_filter('email', 'strtolower')
	->add_rule('name', new Rule\MinLength(5))
	->add_rule('name', new Rule\MaxLength(10))
	->add_rule('email', new Rule\MinLength(5))
	->add_rule('email', new Rule\Email())
	->add_rule('password', new Rule\Matches('password2'))
;

if($validator->is_valid($_POST)) {
	print_r($validator->get_data());
} else {
	print_r($validator->get_errors());
}
```

More detailed examples can be found in ./examples.

3.0 Rule Reference
------------------

[](#30-rule-reference)

- **NotEmpty** Makes this a required field
- **Equal** Input must match provided string
- **NotEqual** Input must not match provided string
- **Matches** Input must match value of another field
- **InArray** Input must be in an array of values
- **MinLength** Input length must be greater than or equal to value
- **MaxLength** Input length must be less than or equal to value
- **ExactLength** Input length must be exactly value
- **Alpha** Input can only contain a-z characters
- **AlphaNumeric** Input can contain a-z and 0-9
- **AlphaSlug** Input can contain a-z, 0-9, - and \_
- **Regex** Input must match provided regular expression
- **Email** Input must be a valid email format
- **URL** Input must be a valid URL format
- **IP** Input must be a valid IPv4 or v6 address
- **True** Input must be true e.g. checkbox
- **Number** Input must be numeric e.g. -99 or 123.45
- **NumNatural** Input must be an integer zero or above
- **NumMin** Input value must be greater than or equal to value
- **NumMax** Input value must be less than or equal to value
- **NumRange** Input value must be between min and max values

4.0 Running Tests
-----------------

[](#40-running-tests)

phpunit tests

5.0 Troubleshooting
-------------------

[](#50-troubleshooting)

@todo

6.0 Changelog
-------------

[](#60-changelog)

- **\[2012-12-08\]** Initial Version
- **\[2013-01-02\]** First Release
- **\[2013-01-04\]** Add more Rules and additional tests

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% 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 ~3 days

Total

3

Last Release

4874d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aedcc742160323259a035924ab75295484c394d67fe1ab3b855620ba790785eb?d=identicon)[Dachande663](/maintainers/Dachande663)

---

Top Contributors

[![Dachande663](https://avatars.githubusercontent.com/u/106847?v=4)](https://github.com/Dachande663 "Dachande663 (17 commits)")[![wknechtel](https://avatars.githubusercontent.com/u/1848962?v=4)](https://github.com/wknechtel "wknechtel (1 commits)")

---

Tags

validationjqueryrulesmodelsservicesFormsclient-side

### Embed Badge

![Health badge](/badges/hybridlogic-validation/health.svg)

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

###  Alternatives

[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M450](/packages/nette-forms)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[pear/html_quickform2

Provides methods to create, validate and render HTML forms in PHP.

24498.9k2](/packages/pear-html-quickform2)[sheadawson/silverstripe-zenvalidator

Faster, easier client and server-side form validation for SilverStripe

5778.4k2](/packages/sheadawson-silverstripe-zenvalidator)[bllim/laravalid

This package makes validation rules defined in laravel work client-side by converting to html/js plugins such as jquery validation. It also allows to use laravel validation messages so you can show same messages for both sides.

5915.2k](/packages/bllim-laravalid)

PHPackages © 2026

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