1. Go to this page and download the library: Download khanhicetea/psr7-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/ */
khanhicetea / psr7-session example snippets
$redis = new \Redis();
$redis->connect('redis_server', 6379, 3);
$redis_handler = new \Psr7Session\Handler\RedisHandler($redis, 3600);
$middleware = SessionMiddleware::create()
->name('I_am_cookie_plz_dont_eat_me')
->httpOnly()
->maxAge(3600)
->handler($redis_handler);
$slim_app->add($middleware);
use Psr7Session\Middleware as SessionMiddleware;
$session = SessionMiddleware::getSession($request);
$default = 123;
$value = $session->get('key', $default);
$value++;
$session->set('key', $value);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.