PHPackages                             inpunktonet/object-flatten - 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. inpunktonet/object-flatten

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

inpunktonet/object-flatten
==========================

This package lets you convert an object with a passed separator into a flat object and back again

v1.0.0(1y ago)05[3 PRs](https://github.com/inpunktonet/object-flatten/pulls)MITPHPPHP ^8.2CI passing

Since Oct 27Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/inpunktonet/object-flatten)[ Packagist](https://packagist.org/packages/inpunktonet/object-flatten)[ Docs](https://github.com/inpunktonet/object-flatten)[ GitHub Sponsors](https://github.com/inpunktonet)[ RSS](/packages/inpunktonet-object-flatten/feed)WikiDiscussions main Synced 1mo ago

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

This package lets you convert an object with a passed separator into a flat object and back again
=================================================================================================

[](#this-package-lets-you-convert-an-object-with-a-passed-separator-into-a-flat-object-and-back-again)

[![Latest Version on Packagist](https://camo.githubusercontent.com/60e58be8491a7c036361b96cd5a002781149516bb1b01173ed43fd9b5325fa7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e70756e6b746f6e65742f6f626a6563742d666c617474656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/inpunktonet/object-flatten)[![Tests](https://camo.githubusercontent.com/8b2a7f75e49d0a0911207cffafbde7c59fc832781c187b6a753a95d35d6145fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696e70756e6b746f6e65742f6f626a6563742d666c617474656e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/inpunktonet/object-flatten/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/6652b93e970dbf7b57e62d41da6ba6b3dcff2097d031098edfb4e2938d9379eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e70756e6b746f6e65742f6f626a6563742d666c617474656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/inpunktonet/object-flatten)

This is where your description should go. Try and limit it to a paragraph or two. Consider adding a small example.

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

[](#installation)

You can install the package via composer:

```
composer require inpunktonet/object-flatten
```

Usage
-----

[](#usage)

### Flatten an object

[](#flatten-an-object)

```
$data = [
    'company' => [
        'name' => 'InPunktoNET',
        'depth' => [
            'level' => 1,
            'level2' => [
                'level3' => 3,
            ],
        ],
    ],
];

$skeleton = new InPunktoNET\ObjectFlatten();
$skeleton->setKeyValueSeparator(';');
$skeleton->setKeySeparator('.');
echo $skeleton->toFlattenString(data: $object);
```

Response:

```
company.name;InPunktoNET
company.depth.level;1
company.depth.level2.level3;3
```

### Unflatten an object

[](#unflatten-an-object)

```
$flattenedStrings = [
    "company.name;InPunktoNET",
    "company.depth.level;1",
    "company.depth.level2.level3;3"
];
```

```
$skeleton = new InPunktoNET\ObjectFlatten();
$skeleton->setKeyValueSeparator(';');
$skeleton->setKeySeparator('.');

echo $skeleton->toObject(data: $object);
```

Response:

```
[
    'company' => [
        'name' => 'InPunktoNET',
        'depth' => [
            'level' => "1",
            'level2' => [
                'level3' => "3",
            ],
        ],
    ],
]
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Jan Späth](https://github.com/inpunktonet)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance67

Regular maintenance activity

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

563d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/545792b75eb7a09e669b7027d617503028a6ab7752f4489c0aeb975a7002c310?d=identicon)[inpunktonet](/maintainers/inpunktonet)

---

Top Contributors

[![ipn](https://avatars.githubusercontent.com/u/1591644?v=4)](https://github.com/ipn "ipn (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![inpunktonet](https://avatars.githubusercontent.com/u/136749257?v=4)](https://github.com/inpunktonet "inpunktonet (2 commits)")

---

Tags

InPunktoNetobject-flatten

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/inpunktonet-object-flatten/health.svg)

```
[![Health](https://phpackages.com/badges/inpunktonet-object-flatten/health.svg)](https://phpackages.com/packages/inpunktonet-object-flatten)
```

###  Alternatives

[powder96/numbers.php

Advanced Mathematics Library for PHP (port of Numbers.js)

15844.0k1](/packages/powder96-numbersphp)

PHPackages © 2026

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