class Cookie implements ArrayAccess (View source)

Set values of an cookie.

Implements ArrayAccess for backwards compatibility.

Properties

$cookie

Methods

__construct(string $name, string $value)

No description

static Cookie
createFromArray(array $cookieArray)

No description

string
getName()

No description

string
getValue()

No description

setPath(string $path)

The path the cookie is visible to. Defaults to "/" if omitted.

string|null
getPath()

No description

setDomain(string $domain)

The domain the cookie is visible to. Defaults to the current browsing context's document's URL domain if omitted.

string|null
getDomain()

No description

setExpiry(int $expiry)

The cookie's expiration date, specified in seconds since Unix Epoch.

int|null
getExpiry()

No description

setSecure(bool $secure)

Whether this cookie requires a secure connection (https). Defaults to false if omitted.

bool|null
isSecure()

No description

setHttpOnly(bool $httpOnly)

Whether the cookie is an HTTP only cookie. Defaults to false if omitted.

bool|null
isHttpOnly()

No description

setSameSite(string $sameSite)

The cookie's same-site value.

string|null
getSameSite()

No description

array
toArray()

No description

bool
offsetExists(mixed $offset)

No description

mixed
offsetGet(mixed $offset)

No description

void
offsetSet(mixed $offset, mixed $value)

No description

void
offsetUnset(mixed $offset)

No description

validateCookieName(string $name)

No description

validateCookieValue(string $value)

No description

Details

__construct(string $name, string $value)

No description

Parameters

string $name

The name of the cookie; may not be null or an empty string.

string $value

The cookie value; may not be null.

static Cookie createFromArray(array $cookieArray)

No description

Parameters

array $cookieArray

The cookie fields; must contain name and value.

Return Value

Cookie

string getName()

No description

Return Value

string

string getValue()

No description

Return Value

string

setPath(string $path)

The path the cookie is visible to. Defaults to "/" if omitted.

Parameters

string $path

string|null getPath()

No description

Return Value

string|null

setDomain(string $domain)

The domain the cookie is visible to. Defaults to the current browsing context's document's URL domain if omitted.

Parameters

string $domain

string|null getDomain()

No description

Return Value

string|null

setExpiry(int $expiry)

The cookie's expiration date, specified in seconds since Unix Epoch.

Parameters

int $expiry

int|null getExpiry()

No description

Return Value

int|null

setSecure(bool $secure)

Whether this cookie requires a secure connection (https). Defaults to false if omitted.

Parameters

bool $secure

bool|null isSecure()

No description

Return Value

bool|null

setHttpOnly(bool $httpOnly)

Whether the cookie is an HTTP only cookie. Defaults to false if omitted.

Parameters

bool $httpOnly

bool|null isHttpOnly()

No description

Return Value

bool|null

setSameSite(string $sameSite)

The cookie's same-site value.

Parameters

string $sameSite

string|null getSameSite()

No description

Return Value

string|null

array toArray()

No description

Return Value

array

bool offsetExists(mixed $offset)

No description

Parameters

mixed $offset

Return Value

bool

mixed offsetGet(mixed $offset)

No description

Parameters

mixed $offset

Return Value

mixed

void offsetSet(mixed $offset, mixed $value)

No description

Parameters

mixed $offset
mixed $value

Return Value

void

void offsetUnset(mixed $offset)

No description

Parameters

mixed $offset

Return Value

void

protected validateCookieName(string $name)

No description

Parameters

string $name

protected validateCookieValue(string $value)

No description

Parameters

string $value