evolutionphp/session

v1.0 2025-02-12 01:28 UTC

This package is auto-updated.

Last update: 2025-03-12 01:50:03 UTC


README

PHP Sessions library

Usage

$config = [
    'name' => 'PHPSESSID', //Session Name
    'save_path' => __DIR__.'/session_directory'
];
$session = new \EvolutionPHP\Session\Session();
$session->start($config);

Session functions

$session = new \EvolutionPHP\Session\Session();
$session->start();

//Set
$session->set('user','root');
//Check if session exists
if($session->has('user')){
    echo 'Session exists';
}
//Unset
$session->remove('user');
//Unset all sessions
$session->clear();
//Destroy
$session->destroy();

Flash Data

$session = new \EvolutionPHP\Session\Session();
$session->start();

//Set
$session->setFlash('user', 'root');
//Check if session exists
if($session->hasFlash('user')){
    echo 'Session exists';
}
//Check if session exists and remove it immediately
if($session->hasFlash('user', true)){
    echo 'Session exists';
}