Cookie
in package
implements
ArrayAccess
Set values of an cookie.
Implements ArrayAccess for backwards compatibility.
Tags
Table of Contents
Interfaces
- ArrayAccess
Properties
- $cookie : array<string|int, mixed>
Methods
- __construct() : mixed
- createFromArray() : Cookie
- getDomain() : string|null
- getExpiry() : int|null
- getName() : string
- getPath() : string|null
- getSameSite() : string|null
- getValue() : string
- isHttpOnly() : bool|null
- isSecure() : bool|null
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- setDomain() : mixed
- The domain the cookie is visible to. Defaults to the current browsing context's document's URL domain if omitted.
- setExpiry() : mixed
- The cookie's expiration date, specified in seconds since Unix Epoch.
- setHttpOnly() : mixed
- Whether the cookie is an HTTP only cookie. Defaults to false if omitted.
- setPath() : mixed
- The path the cookie is visible to. Defaults to "/" if omitted.
- setSameSite() : mixed
- The cookie's same-site value.
- setSecure() : mixed
- Whether this cookie requires a secure connection (https). Defaults to false if omitted.
- toArray() : array<string|int, mixed>
- validateCookieName() : mixed
- validateCookieValue() : mixed
Properties
$cookie
protected
array<string|int, mixed>
$cookie
= []
Methods
__construct()
public
__construct(string $name, string $value) : mixed
Parameters
- $name : string
-
The name of the cookie; may not be null or an empty string.
- $value : string
-
The cookie value; may not be null.
createFromArray()
public
static createFromArray(array<string|int, mixed> $cookieArray) : Cookie
Parameters
- $cookieArray : array<string|int, mixed>
-
The cookie fields; must contain name and value.
Return values
CookiegetDomain()
public
getDomain() : string|null
Return values
string|nullgetExpiry()
public
getExpiry() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetPath()
public
getPath() : string|null
Return values
string|nullgetSameSite()
public
getSameSite() : string|null
Return values
string|nullgetValue()
public
getValue() : string
Return values
stringisHttpOnly()
public
isHttpOnly() : bool|null
Return values
bool|nullisSecure()
public
isSecure() : bool|null
Return values
bool|nulloffsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Attributes
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Attributes
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Attributes
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Attributes
setDomain()
The domain the cookie is visible to. Defaults to the current browsing context's document's URL domain if omitted.
public
setDomain(string $domain) : mixed
Parameters
- $domain : string
setExpiry()
The cookie's expiration date, specified in seconds since Unix Epoch.
public
setExpiry(int $expiry) : mixed
Parameters
- $expiry : int
setHttpOnly()
Whether the cookie is an HTTP only cookie. Defaults to false if omitted.
public
setHttpOnly(bool $httpOnly) : mixed
Parameters
- $httpOnly : bool
setPath()
The path the cookie is visible to. Defaults to "/" if omitted.
public
setPath(string $path) : mixed
Parameters
- $path : string
setSameSite()
The cookie's same-site value.
public
setSameSite(string $sameSite) : mixed
Parameters
- $sameSite : string
setSecure()
Whether this cookie requires a secure connection (https). Defaults to false if omitted.
public
setSecure(bool $secure) : mixed
Parameters
- $secure : bool
toArray()
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>validateCookieName()
protected
validateCookieName(string $name) : mixed
Parameters
- $name : string
validateCookieValue()
protected
validateCookieValue(string $value) : mixed
Parameters
- $value : string