PHP code example of hollodotme / inclomplete-class-accessor

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

    

hollodotme / inclomplete-class-accessor example snippets




namespace MyVendor\MyProject;

use hollodotme\IncompleteClassAccessor\IncompleteClassAccessor;

# 1. Read some serialized object
$serialized = file_get_contents( '/tmp/serialized.txt' );

# 2. Unserialize
$unserialzed = unserialize( $serialized );

# 3. Check for __PHP_Inclomplete_Class
if ( $unserialzed instanceof \__PHP_Inclomplete_Class )
{
    $accessor = new IncompleteClassAccessor( $unserialized );
 
    # Print the original class name
    echo $accessor->getOriginalClassName();
    
    # Print all properties
    print_r( $accessor->getProperties() );
    
    # Print a single property
    echo $accessor->getProperty( 'someProperty' );
}