PHPackages                             sonypradana/validator - 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. sonypradana/validator

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

sonypradana/validator
=====================

Php Validator

v0.8.4(2y ago)315.0k↑146.4%1[1 issues](https://github.com/SonyPradana/validator/issues)2MITPHPPHP ^7.4 || ^8.0

Since Dec 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/SonyPradana/validator)[ Packagist](https://packagist.org/packages/sonypradana/validator)[ RSS](/packages/sonypradana-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (18)Used By (2)

[![elegant validator](https://raw.githubusercontent.com/sonypradana/validator/master/docs/header.png)](https://raw.githubusercontent.com/sonypradana/validator/master/docs/header.png)

 [![Total Downloads](https://camo.githubusercontent.com/bcf84bf2d12152845662911424d4a930ac83c01d05ed2d4f3b462018c702ecc1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6e7970726164616e612f76616c696461746f72)](https://packagist.org/packages/sonypradana/validator) [![Latest Version](https://camo.githubusercontent.com/30d369abad27e5e1bc8699ab4be9e4d083bdb6196fb1fcc6c26bd485880935a6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f536f6e7950726164616e612f76616c696461746f72)](https://github.com/sonypradana/validator/actions) [![test past](https://github.com/SonyPradana/validator/actions/workflows/tests.yml/badge.svg)](https://github.com/SonyPradana/validator/actions/workflows/tests.yml) [![License](https://camo.githubusercontent.com/0478d4391c13feca8cdf9bc8d1aea49d3893d09789a10bf67a844774bc1a3474/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f536f6e7950726164616e612f76616c696461746f72)](https://github.com/SonyPradana/validator/blob/main/LICENSE.md)

Validation &amp; Filter
=======================

[](#validation--filter)

Build elegant validation on top of [(Wixel/GUMP)](https://github.com/Wixel/GUMP), one of the most popular php validation.

Validation
----------

[](#validation)

```
$val = new Validator($_POST);

$val->field('name')->required()->validName();
// or
$val->name->required()->validName();

$val->if_valid(function() {
    // continue
})->else(function($err) {
    // array of error messages
    var_dump($err);
});
```

### **GUMP support**

[](#gump-support)

```
$is_valid = GUMP::is_valid(array_merge($_POST, $_FILES), [
    'username' => vr()->required()->alpha_numeric(),
    'password' => vr()->required()->between_len(6, 100),
    'avatar'   => vr()->required_file()->extension('png', 'jpg')
]);

if ($is_valid === true) {
    // continue
} else {
    // array of error messages
    var_dump($is_valid);
}
```

### **Available method**

[](#available-method)

- `required()`
- `valid_email()`
- `max_len()`
- `min_len()`
- `exact_len()`
- `between_len()`
- `alpha()`
- `alpha_numeric()`
- `alpha_numeric_space()`
- `alpha_numeric_dash()`
- `alpha_dash()`
- `alpha_space()`
- `numeric()`
- `integer()`
- `boolean()`
- `float()`
- `valid_url()`
- `url_exists()`
- `valid_ip()`
- `valid_ipv4()`
- `valid_ipv6()`
- `guidv4()`
- `valid_cc()`
- `valid_name()`
- `contains()`
- `contains_list()`
- `doesnt_contain_list()`
- `street_address()`
- `date()`
- `min_numeric()`
- `max_numeric()`
- `min_age()`
- `invalid()`
- `starts()`
- `extension()`
- `required_file()`
- `equalsfield()`
- `iban()`
- `phone_number()`
- `regex()`
- `valid_json_string()`
- `valid_array_size_greater()`
- `valid_array_size_lesser()`
- `valid_array_size_equal()`

And

- `not()`, for invert all available method.
- `where($condition)`, execute rule if condition true.
- `if($condition)`, execute rule if condition true.

Filter
------

[](#filter)

Fiter field input

```
$val = new Validator($_POST);

$val->filter('name')->trim()->lowwer_case();

// run filter
$filter = $val->filter_out();
```

validation and filter

```
$val = new Validator($_POST);

$val->field('name')->required()->valid_name();
$val->filter('name')->trim()->lowwer_case();

// run validation and filter
$filter = $val->failedOrFilter());
```

### **Why use Validator**

[](#why-use-validator)

Why use valdidator over `GUMP` validator.

- Avoid typo when building validator rule. When using validator may accidentally typing wrong validate rule (typo). It make runtime error.
- Autocomplete out of the box. Auto complete validator rule and maintainable rule.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67% 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 ~48 days

Recently: every ~130 days

Total

17

Last Release

834d ago

PHP version history (2 changes)v0.1.0PHP ^7.4

v0.5.1PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![SonyPradana](https://avatars.githubusercontent.com/u/7188706?v=4)](https://github.com/SonyPradana "SonyPradana (69 commits)")[![anggerpradana](https://avatars.githubusercontent.com/u/75710827?v=4)](https://github.com/anggerpradana "anggerpradana (34 commits)")

---

Tags

elegantphpvalidationvalidatorphpvalidatorpackage

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sonypradana-validator/health.svg)

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

PHPackages © 2026

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