# Session Handling

TIP

Session handling library bundled with Zest Framework.

# Configuration

There is no configuration need for using session library in Zest framework but if you want change session storage path in Config.php you have to change according to the details of your server.

/**
 * Default Session storage path.
 *
 * @var string
 */
const Session_Path = '../Storage/Session/';

1
2
3
4
5
6
7

# Set

For setting the session and its value you need to used setValue() method take a look at an example:

<?php

namespace App\Models;
use Zest\Session\Session;
class users
{

    public function login()
    {
        //its prototype is Session::setvalue("name","value");
        Session::setValue('users',11223);
        //return boolean, true | false
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# Get

To get the session value you need to used getValue() method take a look at an example:

<?php

namespace App\Models;
use Zest\Session\Session;
class users
{

    public function getLogin()
    {
        //its prototype is Session::getValue("name");
        Session::getValue('users');
        //return value on success  boolean false on fail
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# Delete

For deleting the session value you need to used unsetValue() method take a look at example:

<?php

namespace App\Models;
use Zest\Session\Session;
class users
{

    public function logout()
    {
        //its prototype is Session::unsetValue("name");
        Session::unsetValue('users');
        //return boolean, true | false
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# Check

For checking is session is active you need to used isSession() method take a look at an example:

<?php

namespace App\Models;
use Zest\Session\Session;
class users
{

    public function isLogin()
    {
        //its prototype is Session::isSession("name");
        Session::isSession('users');
        //return boolean, true | false
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Last Updated: 3/22/2022, 4:20:26 PM