PHPackages                             linmad/structure-type-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. linmad/structure-type-validation

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

linmad/structure-type-validation
================================

Light and simple validator for structures

v0.0.1(8y ago)115MITPHPPHP &gt;=7

Since Oct 3Pushed 8y agoCompare

[ Source](https://github.com/LinMAD/StructureTypeValidation)[ Packagist](https://packagist.org/packages/linmad/structure-type-validation)[ Docs](https://github.com/LinMAD/StructureTypeValidation)[ RSS](/packages/linmad-structure-type-validation/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Structure Type Validation
-------------------------

[](#structure-type-validation)

[![Build Status](https://camo.githubusercontent.com/fccc667a3826e55470a79c6a500d44fe2efe028c60ae01dcdd99a8786189caa5/68747470733a2f2f7472617669732d63692e6f72672f4c696e4d41442f5374727563747572655479706556616c69646174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/LinMAD/StructureTypeValidation)[![Coverage Status](https://camo.githubusercontent.com/c71342db0b27754129fc031d5cb02c82dff6238107817207588326d6ddef4a62/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4c696e4d41442f5374727563747572655479706556616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/LinMAD/StructureTypeValidation?branch=master)

```
Light and simple structure validator. Do validation of yours structures as expected.

```

#### Where to use

[](#where-to-use)

Generally, if need to work with huge or complex structures and need to be sure the key and value types exist as expected. For example, you work with some API. Your system receives structure, the you must it validate and ways of that is different. One of that way is my, you can create a list of mandatory keys and types to validate structure. It' allows you to cut of wrong work, before executing heavy manipulation with data, for example serialization to object.

### How it works

[](#how-it-works)

Analyzer will compare your structure with your structure mapping with strict types. Then if it founds some mismatches it will put error to bucket and after process you can view errors in bucket. In the end, you will receive a boolean and from that you can understand if structure valid as expected mapping.

In other words, it simply walks in your tree and checks needed keys exist and value type are correct.

### Example of usage

[](#example-of-usage)

For example, for your needs given some data in structure:

```
$paymentReq = '{
    "amount": 10500,
    "ccy": "EUR",
    "account_id": 42,
    "order_description": "facere repellat provident occaecati excepturi optio reprehenderit"
}';
```

And you want to use like "schema", "map" or "structure" to overlay it. For example your map:

```
$payementReqMap = [
    'amount' => 'integer',
    'ccy' => 'string',
    'account_id' => 'integer'
];
```

So, in your structure map key "order\_description" not mandatory and you can accept it or skip. But others keys are strict and mandatory, so you didn't allow pass invalid data to your system.

```
// Create instance
$analyzer = new Analyzer();

// Check if structure same as expected in map
$isValid = $analyzer->isValidStructure($paymentReq, $payementReqMap); // return bool, valid or not as expected

if ($isValid) {
    // Make some magic
    $this->paymentProvider->takeRequest($paymentReq);
}
// Or use other magic
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

3145d ago

### Community

Maintainers

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

---

Top Contributors

[![LinMAD](https://avatars.githubusercontent.com/u/13393702?v=4)](https://github.com/LinMAD "LinMAD (9 commits)")

---

Tags

analyzerarrayjsonphp7strictstructuretypevalidatorjsontypevalidatorarraystructurestrictanalyzer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/linmad-structure-type-validation/health.svg)

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[consistence/consistence

Consistence - consistent approach and additions to PHP's functionality

1831.1M18](/packages/consistence-consistence)[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)[jbzoo/data

An extended version of the ArrayObject object for working with system settings or just for working with data arrays

891.6M23](/packages/jbzoo-data)[lezhnev74/pasvl

Array Validator (regular expressions for nested array, sort of)

5253.7k3](/packages/lezhnev74-pasvl)

PHPackages © 2026

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