class ResponseCookieJar (View source)

Properties

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

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

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

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

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 $secure whether the cookie should only be transmitted over a HTTPS connection from the client
bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol

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