PHPackages                             1blankz7/php-structure-check - 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. 1blankz7/php-structure-check

Abandoned → [cubicl/php-structure-check](/?search=cubicl%2Fphp-structure-check)Library[Utility &amp; Helpers](/categories/utility)

1blankz7/php-structure-check
============================

Structural check of arrays for PHP 7.1+

1.0.0(7y ago)013.6kMIT

Since Jan 7Pushed 5y agoCompare

[ Source](https://github.com/1blankz7/php-structure-check)[ Packagist](https://packagist.org/packages/1blankz7/php-structure-check)[ Docs](https://github.com/cubicldev/php-structure-check)[ RSS](/packages/1blankz7-php-structure-check/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (14)Used By (0)

PHP Structure Check
===================

[](#php-structure-check)

[![Build Status](https://camo.githubusercontent.com/e2e7b8b9bd6f7191fa60d77e1fb44dc4156395378975179588cc62e7f3b216af/68747470733a2f2f7472617669732d63692e6f72672f43756269636c4465762f7068702d7374727563747572652d636865636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/CubiclDev/php-structure-check)[![License](https://camo.githubusercontent.com/35e431d2c0067068585376fc7cffd11dd4d51ab99095653afc74eb33fe55b4d3/68747470733a2f2f706f7365722e707567782e6f72672f63756269636c2f7068702d7374727563747572652d636865636b2f6c6963656e7365)](https://packagist.org/packages/cubicl/php-structure-check)

This library can check a complex array structure against a given requirement. The purpose of this library is to create a better experience when testing a result set from an api or something similar.

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

[](#installation)

```
composer require cubicl/php-structure-check

```

Usage
-----

[](#usage)

Create a requirement:

```
$requirement = new ListType(
    new ObjectType([
        'foo' => new StringType(),
        'bar' => new IntType(),
        'buzz' => new AnyType(),
        'foobar' => new NullableType(new StringType()),
        'nested' => new ObjectType([
            'foobar' => new StringType(),
        ]),
    ])
);
```

Have some sort of external data you want to check.

```
$data = [
    [
        'foo' => 'foe',
        'bar' => 'baz',
        'buzz' => 'foe',
        'foobar' => null,
        'nested' => [
            'foobar' => 'buzz',
        ],
    ], [
        'foo' => 'foe',
        'bar' => 7,
        'buzz' => 'foe',
        'foobar' => 'baz',
        'nested' => [
            'foobar' => 'bozz',
        ],
    ], [
        'foo' => [],
        'bar' => 9.1,
        'foobar' => 'baz',
        'nested' => [
            'foobar' => 'bazz',
        ],
    ],
];
```

Check the data against the requirement.

```
$result = Checker::fulfills($data, $requirement);
```

The returned object holds information about the analysis. You can check the result by calling `isValid()` on the result object. To fetch the errors, simply call `getErrors`.

Supported Types
---------------

[](#supported-types)

Currently the following types are supported:

- Any
- Nullable
- Bool
- Numeric
- Float
- Int
- String
- Object
- List
- Datetime
- Regex
- Optional
- Enum

There are some open issues with ideas for more types. Feel free to send pull requests.

Additionally you can implement the `TypeInterface` and use your own type implementations.

Checks
------

[](#checks)

Checks are special types which can be used to add more rules to a field. So you can check the length of a string, the count of elements in an array or determine if a numeric value is in a given range.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~89 days

Recently: every ~199 days

Total

10

Last Release

2658d ago

Major Versions

0.2.0 → 1.0.02019-03-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5745388?v=4)[Christian Blank](/maintainers/1blankz7)[@1blankz7](https://github.com/1blankz7)

---

Top Contributors

[![1blankz7](https://avatars.githubusercontent.com/u/5745388?v=4)](https://github.com/1blankz7 "1blankz7 (5 commits)")[![MariusRumpf](https://avatars.githubusercontent.com/u/2364426?v=4)](https://github.com/MariusRumpf "MariusRumpf (1 commits)")[![TuningYourCode](https://avatars.githubusercontent.com/u/18467288?v=4)](https://github.com/TuningYourCode "TuningYourCode (1 commits)")

---

Tags

arraystructuretypes

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/1blankz7-php-structure-check/health.svg)

```
[![Health](https://phpackages.com/badges/1blankz7-php-structure-check/health.svg)](https://phpackages.com/packages/1blankz7-php-structure-check)
```

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k423.8M1.4k](/packages/doctrine-collections)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k309.5M3.0k](/packages/symfony-property-access)[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.1k417.9M1.7k](/packages/nette-utils)[league/config

Define configuration arrays with strict schemas and access values with dot notation

565323.7M35](/packages/league-config)[cuyz/valinor

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

1.5k11.7M155](/packages/cuyz-valinor)[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31053.4M49](/packages/openlss-lib-array2xml)

PHPackages © 2026

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