Session

The Session class permits you maintain client's state and track their activity while they browse your site.

id

Get session ID.

session::id();

item

Get item from the session.

session::item('name'); // default section is 'session'
session::item('name', 'section'); // specify custom section

flashItem

Get item from the session and delete it after.

session::flashItem('name'); // default section is 'session'
session::flashItem('name', 'account'); // specify custom section
session::flashItem('customer_data', 'session', 'name'); // get 'name' index from 'customer_data' array

set

Add item to the session.

session::set('name', 'john'); // default section is 'session'
session::set('name', 'john', 'account'); // add it to 'account' section

section

Get all items in the section of the session.

session::section('account');

delete

Delete item from the session.

session::delete('name'); // default section is 'session'
session::delete('name', 'account'); // specify custom 'account' section
session::delete(array('user_id', 'username'));

permission

Get user's permission value.

session::permission('messages_post', 'timeline'); // can user post messages in the timeline?
session::permission('site_access_offline', 'system'); // can user access site when it's offline?

destroy

Destroy all session data.

session::destroy();

toString

Output all session data.

session::toString();