PHP code example of regeda / nest

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

    

regeda / nest example snippets


$nest = new Nest('foo', new Redis());
echo $nest; // -> foo

$nest = new Nest('foo', new Redis());

echo $nest['bar']; // -> foo:bar
echo $nest['bar']['baz']; // -> foo:bar:baz

$redis = new Redis(); // or $memcached = new Memcached()

$user = new Nest('user', $redis);

// getter

foreach ($ids as $id) {
    echo $user[$id]['username']->get(); // makes the proxy to $redis->get('user:$id:username')
}

// setter

$user[$id]['age']->set(18); // $redis->set('user:$id:age', 18)