PHPackages                             woutvw/nested-object - 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. woutvw/nested-object

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

woutvw/nested-object
====================

A PHP class that allows creating nested objects with the flexibility of JSON but the advantages of PHP classes.

v1.0.0(1y ago)06MITPHP

Since Sep 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/woutvw/nested-object)[ Packagist](https://packagist.org/packages/woutvw/nested-object)[ RSS](/packages/woutvw-nested-object/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Nested Object for PHP
=====================

[](#nested-object-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/2c2ac573a40bdea463487e205cc0bcb9213dd0426aa5bda674e9e8c1ec4eab4e/68747470733a2f2f706f7365722e707567782e6f72672f776f757476772f6e65737465642d6f626a6563742f762f737461626c65)](https://packagist.org/packages/woutvw/nested-object)[![Total Downloads](https://camo.githubusercontent.com/78a6aae8df20d8b924b7d9dcd6561f2371d98eb48d273255caf575b16fbaf0a5/68747470733a2f2f706f7365722e707567782e6f72672f776f757476772f6e65737465642d6f626a6563742f646f776e6c6f616473)](https://packagist.org/packages/woutvw/nested-object)[![License](https://camo.githubusercontent.com/4e36619acdadcc603ff2b6e89bdfb35f7c4113e3430787a32b90fed839b7f327/68747470733a2f2f706f7365722e707567782e6f72672f776f757476772f6e65737465642d6f626a6563742f6c6963656e7365)](https://packagist.org/packages/woutvw/nested-object)

A PHP class that allows you to create nested objects with the flexibility of JSON objects, but with the advantages of PHP classes.

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

[](#installation)

Install the package via Composer:

```
composer require woutvw/nested-object
```

Usage
-----

[](#usage)

This class allows you to dynamically create nested objects without predefined structures, similar to working with JSON in JavaScript, but maintaining the advantages of PHP.

### Creating a Nested Object

[](#creating-a-nested-object)

You can create an object with nested properties like this:

```
use WoutVW\NestedObject;

// Initialize with data
$data = [
    'user' => [
        'name' => 'John Doe',
        'email' => 'john@example.com'
    ],
    'status' => 'active'
];

$object = new NestedObject($data);

// Access nested properties
echo $object->user->name; // Outputs 'John Doe'

// Set new properties
$object->user->age = 30;
```

### Setting values

[](#setting-values)

You can assign new values just like a regular object:

```
$object->user->city = 'New York';
```

### Converting to an Array

[](#converting-to-an-array)

You can convert the nested object back to an array using the toArray() method:

```
$array = $object->toArray();
print_r($array);
```

License
-------

[](#license)

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

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

599d ago

### Community

Maintainers

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

---

Top Contributors

[![mm-wout](https://avatars.githubusercontent.com/u/142594467?v=4)](https://github.com/mm-wout "mm-wout (6 commits)")

### Embed Badge

![Health badge](/badges/woutvw-nested-object/health.svg)

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

###  Alternatives

[danielgsims/php-collections

Collection classes for PHP

141409.1k8](/packages/danielgsims-php-collections)[roolith/event

PHP event listener

1551.6k1](/packages/roolith-event)

PHPackages © 2026

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