1. Go to this page and download the library: Download middlewares/php-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/ */
middlewares / php-session example snippets
Dispatcher::run([
new Middlewares\PhpSession(),
function () {
//Use the global $_SESSION variable to get/set data
$_SESSION['name'] = 'John';
}
]);
// Start the session with other name
$session = (new Middlewares\PhpSession())->name('user_session');
// Start the session with a specific session id
$session = (new Middlewares\PhpSession())->id('foo');
// Start the session with a specific session id
$session = (new Middlewares\PhpSession())->options([
'cookie_lifetime' => 86400
]);
// Regenerate the session id after 60 seconds
$session = (new Middlewares\PhpSession())->regenerateId(60);
// Regenerate the session id after 60 seconds, storing the expires date in the key 'expiresAt'
$session = (new Middlewares\PhpSession())->regenerateId(60, 'expiresAt');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.