# Cookie Management
TIP
Cookie Management library bundled with Zest Framework
# Configuration
There is no configuration need for using session library in Zest framework
# Set
For setting the cookie and its value you need to used set_cookie()
function take a look at an example:
<?php
namespace App\Models;
class users
{
public function login()
{
//its prototype is set_cookie($name, $value, $expire, $path, $domain, $secure, $httponly);
set_cookie("test", "bla", 3600, "/", $_SERVER['SERVER_NAME'], true, false);
//return boolean, true | false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# Get
To get the cookie value you need to used get_cookie()
function take a look at an example:
<?php
namespace App\Models;
class users
{
public function getLogin()
{
//its prototype is get_cookie("name");
get_cookie('users');
//return value on success boolean false on fail
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# Delete
For deleting the cookie value you need to used delete_cookie()
function take a look at example:
<?php
namespace App\Models;
class users
{
public function logout()
{
//its prototype is delete_cookie("name");
delete_cookie('users');
//return boolean, true | false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# Check
For checking is cookie is set or exists you need to used is_cookie()
fuunction take a look at an example:
<?php
namespace App\Models;
class users
{
public function isLogin()
{
//its prototype is is_cookie("name");
is_cookie('users');
//return boolean, true | false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13