PHP code example of chekote / noun-store

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

    

chekote / noun-store example snippets


$store = new \Chekote\NounStore\Store();

$john = new Person();
$john->firstName = 'John';
$john->lastName = 'Smith';

$store->set('best friend', $john);

$store->keyExists('best friend');

$assert = new \Chekote\NounStore\Assert($store);
$assert->keyExists('best friend');

$store->get('best friend');

$chris = new Person();
$chris->firstName = 'Chris';
$chris->lastName = 'Pratt';

$store->set('best friend', $chris);

$store->get('best friend');

or

$store->get('2nd best friend');

$store->get('1st best friend');

$store->reset();