PHP code example of jrschumacher / symfony-redis-session-handler

1. Go to this page and download the library: Download jrschumacher/symfony-redis-session-handler 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/ */

    

jrschumacher / symfony-redis-session-handler example snippets


<?
use Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler;

$sessionTimeout = 60 * 60 * 24 * 7; // 1 week
$redisClient = new \Redis('localhost');

new RedisSessionHandler($redisClient, $sessionTimeout);

<?
// Initalization above

$options = array(
    'key_prefix' => 'php:ses:'
);
new RedisSessionHandler($redisclient, $sessionTimeout, $options);