1. Go to this page and download the library: Download ascetik/objectstorage 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/ */
ascetik / objectstorage example snippets
$box = new Box();
$class1 = new MyClass(1);
$class2 = new MyClass(2);
$class3 = new MyClass(3);
$box->push($class2, 'offset2'); // registering class2 with an offset as Box head
$box->unshift($class1, 'offset1'); // registering class2 with an offset as Box tail
$box->associate($class1, 'new offset'); // changing class1 offset
$box->associate($class2, null); // removing class2 offset
$box->associate($class3, 'offset3', $box::IGNORE_ON_MISSING); // $class3 not registered, no action (default behavior)
$box->associate($class3, 'offset3', $box::APPEND_ON_MISSING); // $class3 pushed in Box with its offset
$box->associate($class4, 'offset4', $box::PREPEND_ON_MISSING); // $class4 added as Box tail with its offset
// from last example
$offset1 = $box->valueOf($class1); // 'new offset'
$offset2 = $box->valueOf($class2); // null
$offset3 = $box->valueOf(new MyClass(4)); // null, unregistered object
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.