1. Go to this page and download the library: Download chubbyphp/chubbyphp-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/ */
chubbyphp / chubbyphp-session example snippets
use Chubbyphp\Session\FlashMessage;
use Chubbyphp\Session\Session;
use Psr\Http\Message\ServerRequestInterface as Request;
$session = new Session();
// check for existing key
$session->has($request, 'some.key');
// get value for existing key
$session->get($request, 'some.key', null);
// set value for key
$session->set($request, 'some.key', 'some.value');
// remove existing key
$session->remove($request, 'some.key');
// add flash message
$session->addFlash($request, new FlashMessage(FlashMessage::TYPE_SUCCESS, 'successfully saved'));
// get flash message
$flashMessage = $session->getFlash($request); // removes the flash from session
$app = ...
// sample for slim
$app->add($container['session.middleware']);
use Chubbyphp\Session\Session;
use Chubbyphp\Session\SessionProvider;
use Pimple\Container;
$container->register(new SessionProvider);
// replaceable configuration (set before first middleware use)
$container['session.expirationTime'] = 1200;
$container['session.privateRsaKey'] = '';
$container['session.publicRsaKey'] = '';
$container['session.setCookieHttpOnly'] = true;
$container['session.setCookiePath'] = '/';
$container['session.setCookieSecureOnly'] = true;
/** @var Session $session */
$session = $container['session'];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.