Easy way for manage Session on your website.
composer require chipslays/session
use Session\Session;
require 'vendor/autoload.php';
Session::start([
'name' => 'PHPSSID_CUSTOM_NAME',
'cookie_lifetime' => 86400, // seconds
]);
See more available options here.
Session::set('name', 'chipslays');
Session::get('name');
// second parameter is default value
Session::get('name', 'Unknown name');
Session::pull('name');
Session::has('name'); // true
Session::has('email'); // false
Session::remove('name');
Session::clear();
$sessionId = Session::id();
Session::regenerate();