PHP code example of caridea / session
1. Go to this page and download the library: Download caridea/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/ */
caridea / session example snippets
// When the session starts, a CSRF token will be created and stored
$csrf = new \Caridea\Session\CsrfPlugin();
// Display-once messages can be added using the flash plugin
$flash = new \Caridea\Session\FlashPlugin();
$session = new \Caridea\Session\NativeSession($_COOKIE, [$csrf, $flash]);
$session->resume() || $session->start();
$flash->set('foo', 'bar');
$token = $csrf->getValue();
$values = $session->getValues('my-namespace');
$values['foobar'] = 'abc123';