PHP code example of echo-fusion / sessionmanager

1. Go to this page and download the library: Download echo-fusion/sessionmanager 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/ */

    

echo-fusion / sessionmanager example snippets


use EchoFusion\SessionManager\NativeSession;
use EchoFusion\SessionManager\SessionOptions;

$session = new NativeSession(new SessionOptions(name: 'app_sid', lifetime: 7200));
$session->start();

$session->put('user', 42);
$session->get('user');            // 42
$session->get('missing', 'n/a');  // 'n/a'
$session->has('user');            // true
$session->forget('user');

$session->regenerate();           // new session id, e.g. after login or logout
$session->save();                 // write and close

$session->flash('errors', ['Email is tFlash('errors');  // ['Email is 

use EchoFusion\SessionManager\ArraySession;

$session = new ArraySession();
$session->start();

use EchoFusion\SessionManager\Middleware\StartSessionMiddleware;

$middleware = new StartSessionMiddleware($session);
bash
composer