class ResponseCookieJar (View source)

Properties

private bool $secureDefault
protected Cookie[] $cookies

The list of new cookies to be added to the response.

protected string[] $clearedCookies

The names of the request cookies to be cleared out in response.

Methods

setSecureDefault(bool $default)

Set the value of the "secure" flag when it is set to null.

bool
isSecureDefault()

Get the value of the "secure" flag when it is set to null.

Cookie
addCookie(string $name, string|null $value = null, int $expire = 0, string $path = '/', null|string $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)

Adds a Cookie object to the cookie pantry.

$this
addCookieObject(Cookie $cookie)

Adds a Cookie object to the array of cookies for the object.

Cookie[]
getCookies()

The list of new cookies to be added to the response.

Cookie|null
getCookieByName(string $name)

Get the response cookie given its name.

bool
hasCookie(string $name)

There's a cookie with the specific name in the response cookies?

string[]
getClearedCookies()

The names of the request cookies to be cleared out in response.

$this
clear(string $name)

Clear a cookie.

Details

ResponseCookieJar setSecureDefault(bool $default)

Set the value of the "secure" flag when it is set to null.

Parameters

bool $default

Return Value

ResponseCookieJar

bool isSecureDefault()

Get the value of the "secure" flag when it is set to null.

Return Value

bool

Cookie addCookie(string $name, string|null $value = null, int $expire = 0, string $path = '/', null|string $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)

Adds a Cookie object to the cookie pantry.

Parameters

string $name

The cookie name

string|null $value

The value of the cookie

int $expire

The number of seconds until the cookie expires

string $path

The path for the cookie

null|string $domain

The domain the cookie is available to

bool|null $secure

whether the cookie should only be transmitted over a HTTPS connection from the client. Use NULL to to use the default value

bool $httpOnly

Whether the cookie will be made accessible only through the HTTP protocol

bool $raw

Whether the cookie value should be sent with no url encoding

string|null $sameSite

Whether the cookie will be available for cross-site requests

Return Value

Cookie

$this addCookieObject(Cookie $cookie)

Adds a Cookie object to the array of cookies for the object.

Parameters

Cookie $cookie

Return Value

$this

Cookie[] getCookies()

The list of new cookies to be added to the response.

Return Value

Cookie[]

Cookie|null getCookieByName(string $name)

Get the response cookie given its name.

Parameters

string $name

The key the cookie is stored under

Return Value

Cookie|null

bool hasCookie(string $name)

There's a cookie with the specific name in the response cookies?

Parameters

string $name

Return Value

bool

string[] getClearedCookies()

The names of the request cookies to be cleared out in response.

Return Value

string[]

$this clear(string $name)

Clear a cookie.

Parameters

string $name

Return Value

$this