Documentation

Cookie
in package

Eases reading and writing cookies.

Table of Contents

Methods

delete()  : bool
Nullify and unset a cookie.
get()  : string
Fetch a cookie value
set()  : bool
Sets a cookie with the given parameters.

Methods

delete()

Nullify and unset a cookie.

public static delete(string $name[, string|null $path = null ][, string|null $domain = null ]) : bool
Parameters
$name : string

Cookie name

$path : string|null = null

URL path

$domain : string|null = null

URL domain

Return values
bool

get()

Fetch a cookie value

public static get(string $name[, mixed $default = null ]) : string
Parameters
$name : string

Cookie name

$default : mixed = null

Default value

Return values
string

set()

Sets a cookie with the given parameters.

public static set(string $name[, string|null $value = null ][, int|null $expire = null ][, string|null $path = null ][, string|null $domain = null ][, bool|null $secure = null ][, bool|null $httponly = null ]) : bool
Parameters
$name : string

Cookie name

$value : string|null = null

Cookie value

$expire : int|null = null

Number of seconds before the cookie expires

$path : string|null = null

URL path to allow

$domain : string|null = null

URL domain to allow

$secure : bool|null = null

HTTPS only

$httponly : bool|null = null

HTTP only (requires PHP 5.2 or higher)

Return values
bool
On this page

Search results