sun/session

This package helps you to manage your session easily.

v1.2 2015-07-25 16:24 UTC

This package is auto-updated.

Last update: 2024-12-08 17:18:03 UTC


README

Total Downloads Latest Stable Version Latest Unstable Version License

Session helps you to manage your session data easily.

Installation Process

Just copy Session folder somewhere into your project directory. Then include session autoloader.

 require_once('/path/to/Session/autoload.php');

Session is also available via Composer/Packagist.

 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.

$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.

$session->pull('login');

You can also set default value for session pull method.

$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