The Response retains each cookie as a Sapien\Response\Cookie value object.
final public setCookie(
string $name,
string $value = '',
int $expires = null,
string $path = null,
string $domain = null,
bool $secure = null,
bool $httponly = null,
string $samesite = null
) : static
A buffered equivalent of setcookie()
, with the
various options expanded out to method parameters.
The method is fluent, allowing you to chain a call to another Response method.
final public setRawCookie(
string $name,
string $value = '',
int $expires = null,
string $path = null,
string $domain = null,
bool $secure = null,
bool $httponly = null,
string $samesite = null
) : static
A buffered equivalent of setrawcookie()
, with
the various options expanded out to method parameters.
The method is fluent, allowing you to chain a call to another Response method.
final public setCookie(
string $name,
Cookie $value
) : static
If you have a Cookie instance in hand, you may set it into the Reponse using
setCookie()
.
The method is fluent, allowing you to chain a call to another Response method.
final public setCookies(array $cookies) : static
Resets the Response cookies to the key-value pairs of $cookies
. The value
may be a string, in which case the value will be encoded, or it may be a
Cookie instance, in which case it will be retained as-is.
The method is fluent, allowing you to chain a call to another Response method.
final public getCookie(string $name) : ?Cookie
Returns the $name
Cookie from the Response.
final public getCookies() : array
Returns the array of Cookie objects in the Response.
final public hasCookie(string $name) : bool
Returns true
if the $name
Cookie exists in the Response, false
if not.
final public unsetCookie(string $name) : static
Removes the $name
Cookie from the Response.
The method is fluent, allowing you to chain a call to another Response method.
final public unsetCookies() : static
Removes all Cookie objects from the Response.
The method is fluent, allowing you to chain a call to another Response method.