PHPackages                             dentelis/php-json-structure-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. [Testing &amp; Quality](/categories/testing)
4. /
5. dentelis/php-json-structure-validator

ActiveLibrary[Testing &amp; Quality](/categories/testing)

dentelis/php-json-structure-validator
=====================================

Json data structure validation framework

2.0.0(2y ago)19111MITPHPPHP ~8.2

Since Feb 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dentelis/php-json-structure-validator)[ Packagist](https://packagist.org/packages/dentelis/php-json-structure-validator)[ RSS](/packages/dentelis-php-json-structure-validator/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

dentelis/php-json-structure-validator
=====================================

[](#dentelisphp-json-structure-validator)

Validator is a lightweight PHP library for validating the structure of data retrieved from an external json API.

The library was originally created for use in acceptance api tests, but can be used anywhere else as well.

Specific
--------

[](#specific)

The library was made to test json compatible data structures. Array key validation is not supported.

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

[](#installation)

Use the package manager [composer](https://getcomposer.org/) to install.

```
composer require dentelis/php-json-structure-validator
```

Usage
-----

[](#usage)

You can use library with(or without) any testing framework you want.

See [dentelis/phpunit-json-assert](https://github.com/dentelis/phpunit-json-assert) for PhpUnit support.

```
//object example
$user = (new ObjectType())
    ->addProperty('name', (new StringType())->assertNotEmpty())
    ->addProperty('email', (new StringType())->assertEmail());

$data = json_decode('{"name":"user", "email":"user@example.com"}');
try {
    $user->validate($data);
} catch (ValidationException $e) {
    //do smth

}

//array of objects
$users = (new ArrayType())
    ->assertNotEmpty()
    ->assertType($user);

$data = json_decode('[{"name":"user", "email":"user@example.com"},{"name":"user", "email":"user@example.com"}]');
try {
    $users->validate($data);
} catch (ValidationException $e) {
    //do smth

}
```

See [examples](https://github.com/dentelis/validator/tree/master/examples) directory for full example.

Todo
----

[](#todo)

- more examples
- proper path in exceptions
- do not fail on first exception
- comments translate to english
- create TypeInterface from Classname (what to do with arrays)

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Unknown

Total

1

Last Release

923d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5281445?v=4)[Dim Entelis](/maintainers/dentelis)[@dentelis](https://github.com/dentelis)

---

Top Contributors

[![dentelis](https://avatars.githubusercontent.com/u/5281445?v=4)](https://github.com/dentelis "dentelis (74 commits)")

---

Tags

assertassertionsjsonphp8structuretestingvalidatevalidation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dentelis-php-json-structure-validator/health.svg)

```
[![Health](https://phpackages.com/badges/dentelis-php-json-structure-validator/health.svg)](https://phpackages.com/packages/dentelis-php-json-structure-validator)
```

PHPackages © 2026

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