1. Go to this page and download the library: Download garyr/memento 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/ */
garyr / memento example snippets
$file = new Memento\Engine\File(
array(
'path' => '/tmp/memento', // defaults to sys_get_temp_dir() . '/memento'
)
);
// client instance (defaults to file based storage)
$memento = new Memento\Client($file);
$memcache = new Memento\Engine\Memcache(
array(
'host' => '127.0.0.1',
'port' => 11211
)
);
// client instance
$memento = new Memento\Client($memcache);
$redis = new Memento\Engine\Redis(
array(
'host' => '127.0.0.1',
'port' => 6379
)
);
// client instance
$memento = new Memento\Client($redis);
// single key store request
$memento->store(new Memento\Key('com.example.key'), array('mydata'));
$groupKey = new Memento\Group\Key('com.example.group1');
// group key store request (multiple keys per group key)
$memento->store(
$groupKey,
new Memento\Key('com.example.key1'),
array('mydata')
);
$memento->store(
$groupKey,
new Memento\Key('com.example.key2'),
array('foo' => 'bar')
);
// single key retrieve request
$data = $memento->retrieve(new Memento\Key('com.example.key'));
$groupKey = new Memento\Group\Key('com.example.group1');
// group key retrieve request
$data = $memento->retrieve(
$groupKey,
new Memento\Key('com.example.key1')
);
$data = $memento->retrieve(
$groupKey,
new Memento\Key('com.example.key2')
);
// single key invalidate request
$memento->invalidate(new Memento\Key('com.example'));
// group key store request (invalidate a group in a single operation)
$memento->invalidate(new Memento\Group\Key('com.example.group1'));