# Session

Instead of managing the $_SESSION variable directly, you can use the Wolff Session class. Every controller has one named session.

All the session methods work with the time expressed in minutes (unless it’s specified here).

General methods

start

Start the session:

$this->session->start();

count

Count the session variables:

$this->session->count();

setTime

Set the session global time:

$this->session->setTime(10);

getStartTime

Get the session time (in seconds):

$this->session->getStartTime();

Get session time with format (Hours, minutes and seconds):

$this->session->getStartTime(true);

getRaminingTime

Get session remaining time (in seconds):

$this->session->getRemainingTime();

Get session remaining time with format (Hours, minutes and seconds):

$this->session->getRemainingTime(true);

unset

Unset session:

$this->session->empty();

destroy

Destroy session:

$this->session->kill();

Variable methods

set

Declare a session variable:

$this->session->set('name', $value);

get

Getting a session variable:

$this->session->get('name');

has

Check if a session variable exists:

$this->session->has('name');

unset

Unset a session variable:

$this->session->unset('name');

getVarTime

Getting variable time (in seconds):

$this->session->getVarTime('name');

Getting variable time with format (Hours, minutes and seconds):

$this->session->getVarTime('name', true);

setVarTime

Setting variable time:

$this->session->setVarTime('name', 10);

addVarTime

Adding time to a variable:

$this->session->addVarTime('name', 10);