Sessions
The session is a static class, this means it can be used in any controller or model without
needing to be instantiated.
The advantages of using a session class is all sessions are prefixed using the parameter
session_prefix from the configuration file, this avoid sessions clashing
with other applications on the same domain.
How to use
Setting a session, call Session then ::set pass in the session name followed by its value
\Core\Helpers\Session::set('username', 'crater');
To retrieve an existing session use the get method:
\Core\Helpers\Session::get('username');
Pull an existing session key and remove it, use the pull method:
\Core\Helpers\Session::pull('username');
Use id to return the session id:
\Core\Helpers\Session::id();
Destroy a session key by calling:
\Core\Helpers\Session::destroy('username');
To look inside the sessions array, call the display method:
var_dump(\Core\Helpers\Session::display());↑