class CookieJar (View source)

Constants

SAME_LAX

SAME_NONE

SAME_STRICT

DISALLOW_NAME_CHARS

DISALLOW_VALUE_CHARS

DELETE

DELIMITER

Methods

__construct(string $jar)

No description

setDomain(string $domain)

Defines the host to which the cookie will be sent.

setPath(string $path)

Indicates the path that must exist in the requested URL for the browser to send the Cookie header.

setExpires(string $datetime)

Indicates the maximum lifetime of the cookies.

setHttpOnly(bool $enable)

Forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.

setPartitioned(bool $enable)

Indicates that the cookie should be stored using partitioned storage.

setSameSite(int $mode)

Controls whether or not a cookie is sent with cross-site requests.

setSecure(bool $enable)

Indicates that the cookie is sent to the server only when a request is made with the https scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks.

mixed
__get(string $name)

Magic method for get property value from jar

__set(string $name, string|null $value)

Magic method for set or remove cookie jar properties

bool
__isset(string $name)

Magic method for check if variable is setted

send()

Send cookies from jar to headers

Details

__construct(string $jar)

No description

Parameters

string $jar

Define jar name (cookie name prefix)

setDomain(string $domain)

Defines the host to which the cookie will be sent.

Note: Contrary to earlier specifications, leading dots in domain names (.example.com) are ignored.

Parameters

string $domain

setPath(string $path)

Indicates the path that must exist in the requested URL for the browser to send the Cookie header.

Parameters

string $path

setExpires(string $datetime)

Indicates the maximum lifetime of the cookies.

Note: Accept English textual datetime descriptions (e.g., '+1 day', 'last Monday').

Parameters

string $datetime

setHttpOnly(bool $enable)

Forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.

Parameters

bool $enable

setPartitioned(bool $enable)

Indicates that the cookie should be stored using partitioned storage.

Note that if this is set, the Secure directive must also be set.

Parameters

bool $enable

setSameSite(int $mode)

Controls whether or not a cookie is sent with cross-site requests.

Parameters

int $mode

setSecure(bool $enable)

Indicates that the cookie is sent to the server only when a request is made with the https scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks.

Parameters

bool $enable

mixed __get(string $name)

Magic method for get property value from jar

Parameters

string $name

Return Value

mixed

__set(string $name, string|null $value)

Magic method for set or remove cookie jar properties

Parameters

string $name
string|null $value

Exceptions

Exception

bool __isset(string $name)

Magic method for check if variable is setted

Parameters

string $name

Return Value

bool

send()

Send cookies from jar to headers

Exceptions

Exception