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

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

klapuch/validation
==================

Broad variation of validation

2.6.3(7y ago)07.1k[1 issues](https://github.com/klapuch/Validation/issues)2PHPPHP &gt;=7.1

Since Dec 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/klapuch/Validation)[ Packagist](https://packagist.org/packages/klapuch/validation)[ Docs](https://www.github.com/klapuch/Validation)[ RSS](/packages/klapuch-validation/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (9)Versions (13)Used By (2)

Validation
==========

[](#validation)

[![Build Status](https://camo.githubusercontent.com/2453ed6170c48bdd313cbc1ae148891083b30421ecd5820cfb83efd0c6f0f26f/68747470733a2f2f7472617669732d63692e6f72672f6b6c61707563682f56616c69646174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/klapuch/Validation)[![Build status](https://camo.githubusercontent.com/6521e295af835b627cb48a91ec1ac5549ed8630e129c34c4d095dd7efe3729a7/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6e366831367538723034676830396f313f7376673d74727565)](https://ci.appveyor.com/project/facedown/validation)[![Coverage Status](https://camo.githubusercontent.com/c591d8e241d09c4efe2ee8c88ef7de72cf5daf129b8b9a95bbe8f94640aedaff/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6b6c61707563682f56616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/klapuch/Validation?branch=master)

Documentation
-------------

[](#documentation)

### Installation

[](#installation)

`composer require klapuch/validation`

### Usage

[](#usage)

#### Single rule

[](#single-rule)

```
(new EmptyRule())->satified('abc'); // false
(new EmptyRule())->satified(''); // true
(new EmptyRule())->apply('abc'); // \UnexpectedValueException - 'Subject is not empty'
(new FriendlyRule(new EmptyRule(), 'Not empty!'))->apply('abc'); // \UnexpectedValueException - 'Not empty!'
```

#### Chained rule

[](#chained-rule)

```
(new ChainedRule(
	new FriendlyRule(
		new NegateRule(new EmptyRule()),
		'Value can not be empty'
	),
	new LengthRule(10),
	new PassiveRule, // it does nothing
	new EmailRule(),
))->apply('abc');
```

The above code says that a value can not be empty, length of the value must be exact 10 characters and the value must be email.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~69 days

Recently: every ~144 days

Total

12

Last Release

2694d ago

Major Versions

1.1.0 → 2.0.02016-12-13

### Community

Maintainers

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

---

Top Contributors

[![klapuch](https://avatars.githubusercontent.com/u/17772194?v=4)](https://github.com/klapuch "klapuch (43 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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