PHP code example of g4 / identity-map

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

    

g4 / identity-map example snippets


use G4\IdentityMap\IdentityMap;

$identityMap = new IdentityMap();

$key = 'some_unique_key';
$data = 'some_data';

// add data 
$identityMap->set($key, $data);

// retrieve data
$data = $identityMap->get($key);

// check if data is stored
$identityMap->has($key);

// remove data
$identityMap->delete($key);

// clear all
$identityMap->clear();