PHP code example of woutvw / nested-object

1. Go to this page and download the library: Download woutvw/nested-object library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

woutvw / nested-object example snippets



use WoutVW\NestedObject;

// Initialize with data
$data = [
    'user' => [
        'name' => 'John Doe',
        'email' => '[email protected]'
    ],
    'status' => 'active'
];

$object = new NestedObject($data);

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

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



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



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