1. Go to this page and download the library: Download romeoz/rock-session 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/ */
romeoz / rock-session example snippets
$config = [
'cache' => new \rock\cache\Memcached
];
$session = new \rock\session\MemorySession($config);
$session->add('name', 'Tom');
echo $session->get('name'); // result: Tom
$config = [
'connection' => new \rock\mongodb\Connection
];
$session = new \rock\session\MongoSession($config);
$session->add('name', 'Tom');
echo $session->get('name'); // result: Tom
$connection = new \rock\mongodb\Connection;
// Create TTL index
$connection
->getCollection('session')
->createIndex('expire', ['expireAfterSeconds' => 0]);
$config = [
'connection' => $connection,
'useGC' => false
];
$session = new \rock\session\MongoSession($config);
$session->add('name', 'Tom');
echo $session->get('name'); // result: Tom
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.