PHP code example of xchert / encapsulation-accessor

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

    

xchert / encapsulation-accessor example snippets


use Xchert\PropertyAccess\PropertyAccessor;
use Xchert\PropertyAccess\EncapsulationAccessor;
use Xchert\PropertyAccess\ContainerAccessor;

$propertyAccessor = new PropertyAccessor();

// Register EncapsulationAccessor for encapsulation support
$propertyAccessor->registerAccessor(new EncapsulationAccessor(), EncapsulationAccessor::ID, 500);

// Register ContainerAccessor for container support
$propertyAccessor->registerAccessor(new ContainerAccessor(), ContainerAccessor::ID, 500);