PHP code example of eppak / value

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

    

eppak / value example snippets



    use eppak\value;
    
    //...
    
    $data = [ 'testRead' => 'read',
              'testWrite' => 'write',
              'testReadWrite' => 'readwrite',
              'undisciplined' => 'readwrite' ];
    
    $value = new Value( $data );
    $value = new Value( $data, [ 'testRead' => static::R,
                                 'testWrite' => static::W,
                                 'testReadWrite' => static::RW ] );    

    $value = Value::fromArray( $data );
    $value = Value::fromJson( '{"test": "read"}' );


    $testRead =  $value->getTestRead();
    $testReadWrite =  $value->getTestReadWrite();
    
    $value->setTestReadWrite('some value');
    $value->setTestRead('some value'); // Thrown an error, is read only    


    $json = Json::fromJson('{ "test": { "test1" : { "test2": { "test3" : 1} } }}');
    $testRead_present = $json->has('test');
    $testChin_present = $json->hasChain('test', 'test1>test2>test3');