class CookieJar (View source)

Constants

SAME_DEFAULT

SAME_LAX

SAME_NONE

SAME_STRICT

DISALLOW_NAME_CHARS

DISALLOW_VALUE_CHARS

DELETE

DELIMITER

MAX_SIZE

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.

string|null
__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

__unset(string $name)

Magic method for unset variable with unset() function

send()

Send cookies from jar to headers

Details

__construct(string $jar)

No description

Parameters

string $jar

Define jar name (cookie name prefix)

Exceptions

Exception

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

Exceptions

Exception

setPath(string $path)

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

Parameters

string $path

Exceptions

Exception

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

Exceptions

Exception

setHttpOnly(bool $enable)

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

Parameters

bool $enable

Exceptions

Exception

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

Exceptions

Exception

setSameSite(int $mode)

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

Parameters

int $mode

Exceptions

Exception

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

Exceptions

Exception

string|null __get(string $name)

Magic method for get property value from jar

Parameters

string $name

Return Value

string|null

__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

__unset(string $name)

Magic method for unset variable with unset() function

Parameters

string $name

send()

Send cookies from jar to headers

Exceptions

ErrorException