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

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

graze/data-validator
====================

Validate data, decoupled from your front end presentation.

v0.2.0(10y ago)125.8k↓41.7%MITPHPPHP ^5.5 || ^7.0CI failing

Since Feb 16Pushed 6y ago11 watchersCompare

[ Source](https://github.com/graze/data-validator)[ Packagist](https://packagist.org/packages/graze/data-validator)[ RSS](/packages/graze-data-validator/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (6)Versions (4)Used By (0)

graze/data-validator [![Build Status](https://camo.githubusercontent.com/fab18d794a35c7b606558571d7e5aea05239e26b7f63299230592b47ebb92162/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6772617a652f646174612d76616c696461746f722f6d61737465722e737667)](https://travis-ci.org/graze/data-validator) [![Latest Version](https://camo.githubusercontent.com/b91ddc53bb67e99bbfc2c376cb37b3a60434532eae7a87337cdfff658940e4b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6772617a652f646174612d76616c696461746f722e737667)](https://packagist.org/packages/graze/data-validator) [![MIT Licensed](https://camo.githubusercontent.com/7c046019d7bfe3ae411a6be3e2ff95c254a0efc47c1d54091acaebab597ef731/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6772617a652f646174612d76616c696461746f722e737667)](https://github.com/graze/data-validator/blob/master/LICENSE)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#grazedata-validator---)

Validate data, decoupled from your front end presentation.

Installation
------------

[](#installation)

We recommend installing this library with [Composer](https://getcomposer.org).

```
$ composer require graze/data-validator
```

Usage
-----

[](#usage)

```
use Graze\DataValidator\DataValidator;

$validator = new DataValidator();

// Add a processor to roughly capitalize first names.
$validator->addProcessor(function (array $data) {
    $data['first_name'] = ucfirst($data['first_name']);
    return $data;
});

// Add a validator to check against a 'reserved' list.
$validator->addValidator(function (array $data) {
    if (in_array($data['first_name'], ['Sam', 'John', 'Ray'])) {
        return 'reserved_name';
    }
});

/** @var array */
$processed = $validator->process(['first_name' => 'sam']);

/** @var array */
$failures = $validator->validate($processed);

var_dump($failures);
```

The above would output:

```
array(1) {
  ["reserved_name"]=>
  bool(true)
}

```

License
-------

[](#license)

The content of this library is released under the **MIT License** by **Nature Delivered Ltd**.

You can find a copy of this license at  or in [`LICENSE`](./LICENSE.md).

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~0 days

Total

2

Last Release

3780d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/637788?v=4)[graze.com](/maintainers/graze)[@graze](https://github.com/graze)

---

Top Contributors

[![sjparkinson](https://avatars.githubusercontent.com/u/51677?v=4)](https://github.com/sjparkinson "sjparkinson (7 commits)")[![biggianteye](https://avatars.githubusercontent.com/u/1482649?v=4)](https://github.com/biggianteye "biggianteye (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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