Session
, (*1)
Session helps you to manage your session data easily., (*2)
Installation Process
Just copy Session folder somewhere into your project directory. Then include session autoloader., (*3)
require_once('/path/to/Session/autoload.php');
Session is also available via Composer/Packagist., (*4)
composer require sun/session
All Methods
To store session data
$session = new Sun\Session;
$session->create('login', 'username');
To get session data
$session->get('login');
You can also set default value for session get method., (*5)
$session->get('login', 'users');
To delete session data
$session->get('login');
To check session exists
$session->has('login');
To pull session data
The pull method retrieve session data then delete this session immediately., (*6)
$session->pull('login');
You can also set default value for session pull method., (*7)
$session->pull('login','users');
To push session data into session array
$session->push('login', ['user']);
To pop session data from session array
$session->pop('login');
To shift session data from session array
$session->shift('login');
To destroy all session data
$session->destroy();
License
This package is licensed under the MIT License, (*8)