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

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

andileong/validation
====================

a pure php validation package

0.03(3y ago)035PHPPHP ^8.0

Since Nov 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/andiLeong/validation)[ Packagist](https://packagist.org/packages/andileong/validation)[ RSS](/packages/andileong-validation/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

[![example workflow](https://github.com/andiLeong/validation/actions/workflows/test.yml/badge.svg)](https://github.com/andiLeong/validation/actions/workflows/test.yml/badge.svg)

Validation
==========

[](#validation)

Includes some handful validation rules, it supports custom error message, closure syntax rule , passing object rule , no framework required.

but only some validation rules are include like

##### required

[](#required)

##### required\_if

[](#required_if)

#### min

[](#min)

#### max

[](#max)

#### between

[](#between)

#### in

[](#in)

#### alpha\_num

[](#alpha_num)

#### boolean

[](#boolean)

#### decimal

[](#decimal)

#### ends\_with

[](#ends_with)

#### ip

[](#ip)

#### is\_array

[](#is_array)

#### is\_string

[](#is_string)

#### json

[](#json)

#### number

[](#number)

#### timezone

[](#timezone)

Interested on how the Laravel validation works that's main reason drive me develop this package. Not intent to use in production but just for quick exercise

When package is complete. I compare this to Laravel's validation component, it really helps me to have better understanding of how the framework validator works under the hood and really improve my skill-sets.

#### Reading code is as important as writing code.

[](#reading-code-is-as-important-as-writing-code)

How to use
==========

[](#how-to-use)

```

$data = [
    'name' => 'foo',
];

$validator = new Validator($data);
try{
    $validated = $validator->validate([
        'name' => 'required|min:3|max:5',
        'age' => ['required','between:18,60'],
        'foo' => ['required',fn($value) => $value == 'bar'],
        'object' => ['required',new Custom('validation')],
        'sex' => 'required_if:name',
    ],[
        'name.max' => 'The :key must in :argument long, you had provided :value which is not valid',
        'foo.closure' => 'The :key must in bar'
    ]);

}catch(ValidationException $exception){

    //validation fails do whatever
    //$errors contains all errors message.
    $errors = $exception->errors();

}

$validated is the return array only contains the rules keys

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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 ~16 days

Total

4

Last Release

1279d ago

### Community

Maintainers

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

---

Top Contributors

[![andiLeong](https://avatars.githubusercontent.com/u/68339288?v=4)](https://github.com/andiLeong "andiLeong (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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