PHP code example of sunnyflail / object-accessor

1. Go to this page and download the library: Download sunnyflail/object-accessor 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/ */

    

sunnyflail / object-accessor example snippets


$accessor = new SunnyFlail\ObjectAccessor\ObjectAccessor();

$object = new Object();
$objectAccessor = $accessor->access($object);

$hasProperty = $objectAccessor->has('property');

$hasProperty = $objectAccessor->isInitialised('property');

$propertyValue = $objectAccessor->get('property');

$objectAccessor->set('property', 123);