The session configuration is stored in app/config/session.php
.
The session driver
defines where session data will be stored. The supported drivers are:
native
- sessions will be handled by internal PHP session facilities.file
- sessions will be stored inapp/storage/sessions
.database
- sessions will be stored in thesessions
table.
Session::set('key', 'value');
Session::push('user.teams', 'developers');
$value = Session::get('key');
$value = Session::get('key', 'default');
$data = Session::all();
if (Session::has('key')) {
//
}
Session::delete('key');
Session::destroy();
Sometimes you may wish to store items in the session only for the next request. You may do so using the Session::flash
method:
Session::flash('key', 'value');
Session:deleteFlash();
See src/Hazzard/Session/Store.php
for the full list of methods.