PHPackages                             endermanbugzjfc/configstruct - 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. endermanbugzjfc/configstruct

Abandoned → [sylvrs/libmarshal](/?search=sylvrs%2Flibmarshal)Library[Utility &amp; Helpers](/categories/utility)

endermanbugzjfc/configstruct
============================

2.1.0(3y ago)917MITPHPPHP &gt;=8.0

Since Feb 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Endermanbugzjfc/ConfigStruct)[ Packagist](https://packagist.org/packages/endermanbugzjfc/configstruct)[ RSS](/packages/endermanbugzjfc-configstruct/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (14)Used By (0)

Gave up maintenance （不羈放縱愛自由）
=============================

[](#gave-up-maintenance-不羈放縱愛自由)

Use  instead.

ConfigStruct
============

[](#configstruct)

Type and shape system for arrays. Help write clearer code when implementing configs for your PocketMine-MP plugin or composer project.

It also generates more human-readable errors when something is wrong with the data. Encouraging and guiding the user (especially some PocketMine-MP server owners) to read the error and fix their mess.

[![](https://camo.githubusercontent.com/177668875d699c2c2e284e6509746d3199484cc776bb907e870c2131a6179484/68747470733a2f2f692e696d67666c69702e636f6d2f3637797963392e6a7067)](https://camo.githubusercontent.com/177668875d699c2c2e284e6509746d3199484cc776bb907e870c2131a6179484/68747470733a2f2f692e696d67666c69702e636f6d2f3637797963392e6a7067)

 is an alternative that supports lower versions of PHP. However, it is not as bloat feature-rich as this library.

The section that everyone is looking for
========================================

[](#the-section-that-everyone-is-looking-for)

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

[](#installation)

Via Composer:

```
composer require endermanbugzjfc/configstruct

```

Via PocketMine-MP virion infection:

Preview
-------

[](#preview)

### Parse errors

[](#parse-errors)

```
2 errors in /Users/Shoghi/Documents/shog chips.yml
    1 errors in element "a"
        1 errors in index "0"
            1 errors in element "c"
                Element is array while it should be string
    1 errors in element "b"
        Element is null while it should be bool

```

Notice there is a trailing line break.

Developer guide
===============

[](#developer-guide)

Parsing data
------------

[](#parsing-data)

```
use Endermanbugzjfc\ConfigStruct\Parse;
```

```
$context = Parse::object($object, $data);
$context->copyToObject($object, $dataFilePath);
```

`$dataFilePath` will be displayed in error messages if there is any.

The errors will be wrapped and thrown with a [ParseErrorsWrapper](https://github.com/Endermanbugzjfc/ConfigStruct/blob/master/ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseErrorsWrapper.php) when calling `copyToObject()`. Although it is recommended to catch it, you can yet ignore it. Because the errors can still be displayed well in a PHP uncaught error message.

You may use `Parse::objectByReflection()` if you don't have an object but instead, its ReflectionClass instance. And use `$context->copyToNewObject()` to copy the parsed data to a new object.

Customising error message
-------------------------

[](#customising-error-message)

### Changing the root header label

[](#changing-the-root-header-label)

`/Users/Shoghi/Documents/shog chips.yml` is the root header label in the following errors tree:

```
2 errors in /Users/Shoghi/Documents/shog chips.yml
    1 errors in element "a"
        1 errors in index "0"
            1 errors in element "c"
                Element is array while it should be string
    1 errors in element "b"
        Element is null while it should be bool

```

You can change it in the first argument of `ParseErrorsWrapper::regenerateErrorMessage()`:

```
$parseErrorsWrapper->regenerateErrorMessage('C:\Windows\System32\ntoskrnl.exe');
```

### Changing the indentation

[](#changing-the-indentation)

You can change it in the second argument of `ParseErrorsWrapper::regenerateErrorMessage()`

### Filtering errors

[](#filtering-errors)

You can hide certain errors from the errors tree by filtering them out. Apply an error filter with the third argument of `ParseErrorsWrapper::regenerateErrorMessage()`:

```
$parseErrorsWrapper->regenerateErrorMessage(
    $parseErrorsWrapper->getRootHeaderLabel(),
    $parseErrorsWrapper->getIndentation(),
    fn (array $keys, BaseParseError $parseError) : bool => !$parseError instanceof TypeMismatchError
);
```

This filters out all the [TypeMismatchError](https://github.com/Endermanbugzjfc/ConfigStruct/blob/master/ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseError/TypeMismatchError.php). Although `$parseError->getErrorsTree()` will still have them, they will not be shown in the error message.

### Print the updated error message

[](#print-the-updated-error-message)

Simply throw the parse errors wrapper again. Or you may choose to `echo $parseErrorsWrapper->getMessage()`. By default, the error message has a trailing line break (`\n`). You can get an error message without the trailing line break (and other whitespaces) by calling `$parseErrorsWrapper->getMessageRtrim()` instead.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 99.9% 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 ~21 days

Total

6

Last Release

1458d ago

Major Versions

1.0.0 → 2.0.0-BETA12022-03-11

2.0.0 → v3.x-dev2022-05-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/43c1d6d1c6f4be392954b2c6b0d16276e5ada1b3583a63b5dd07abe8d4ccce84?d=identicon)[Endermanbugzjfc](/maintainers/Endermanbugzjfc)

---

Top Contributors

[![Endermanbugzjfc](https://avatars.githubusercontent.com/u/53002741?v=4)](https://github.com/Endermanbugzjfc "Endermanbugzjfc (887 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (1 commits)")

---

Tags

arrayconfigdatapmpmmppocketmineshapestructstructurevirion

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/endermanbugzjfc-configstruct/health.svg)

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

###  Alternatives

[umbrella/boleto

YaBoleto é uma biblioteca para geração de boletos bancários de forma simples em PHP.

3431.2k](/packages/umbrella-boleto)

PHPackages © 2026

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