Methods |
public
|
getId(): string
Returns a unique identifier for the cookie consisting
of its prefixed name, path, and domain.
Returns a unique identifier for the cookie consisting
of its prefixed name, path, and domain.
Implemented by
|
#
|
public
|
getPrefix(): string
Gets the cookie prefix.
|
#
|
public
|
getName(): string
Gets the cookie name.
|
#
|
public
|
getPrefixedName(): string
Gets the cookie name prepended with the prefix, if any.
Gets the cookie name prepended with the prefix, if any.
Implemented by
|
#
|
public
|
getValue(): string
Gets the cookie value.
|
#
|
public
|
getExpiresTimestamp(): int
Gets the time in Unix timestamp the cookie expires.
Gets the time in Unix timestamp the cookie expires.
Implemented by
|
#
|
public
|
getExpiresString(): string
Gets the formatted expires time.
Gets the formatted expires time.
Implemented by
|
#
|
public
|
isExpired(): bool
Checks if the cookie is expired.
Checks if the cookie is expired.
Implemented by
|
#
|
public
|
getMaxAge(): int
Gets the "Max-Age" cookie attribute.
Gets the "Max-Age" cookie attribute.
Implemented by
|
#
|
public
|
getPath(): string
Gets the "Path" cookie attribute.
Gets the "Path" cookie attribute.
Implemented by
|
#
|
public
|
getDomain(): string
Gets the "Domain" cookie attribute.
Gets the "Domain" cookie attribute.
Implemented by
|
#
|
public
|
isSecure(): bool
Gets the "Secure" cookie attribute.
Gets the "Secure" cookie attribute.
Checks if the cookie is only sent to the server when a request is made
with the https: scheme (except on localhost ), and therefore is more
resistent to man-in-the-middle attacks.
Implemented by
|
#
|
public
|
isHTTPOnly(): bool
Gets the "HttpOnly" cookie attribute.
Gets the "HttpOnly" cookie attribute.
Checks if JavaScript is forbidden from accessing the cookie.
Implemented by
|
#
|
public
|
getSameSite(): string
Gets the "SameSite" cookie attribute.
Gets the "SameSite" cookie attribute.
Implemented by
|
#
|
public
|
isRaw(): bool
Checks if the cookie should be sent with no URL encoding.
Checks if the cookie should be sent with no URL encoding.
Implemented by
|
#
|
public
|
getOptions(): array<string, mixed>
Gets the options that are passable to the `setcookie` variant
available on PHP 7.3+
Gets the options that are passable to the setcookie variant
available on PHP 7.3+
Implemented by
|
#
|
public
|
toHeaderString(): string
Returns the Cookie as a header value.
Returns the Cookie as a header value.
Implemented by
|
#
|
public
|
__toString(): string
Returns the string representation of the Cookie object.
Returns the string representation of the Cookie object.
Implemented by
|
#
|
public
|
toArray(): array<string, mixed>
Returns the array representation of the Cookie object.
Returns the array representation of the Cookie object.
Implemented by
|
#
|
Constants |
public
|
SAMESITE_NONE = 'none'
Cookies will be sent in all contexts, i.e in responses to both
first-party and cross-origin requests. If `SameSite=None…
Cookies will be sent in all contexts, i.e in responses to both
first-party and cross-origin requests. If SameSite=None is set,
the cookie Secure attribute must also be set (or the cookie will be blocked).
|
#
|
public
|
SAMESITE_LAX = 'lax'
Cookies are not sent on normal cross-site subrequests (for example to
load images or frames into a third party site),…
Cookies are not sent on normal cross-site subrequests (for example to
load images or frames into a third party site), but are sent when a
user is navigating to the origin site (i.e. when following a link).
|
#
|
public
|
SAMESITE_STRICT = 'strict'
Cookies will only be sent in a first-party context and not be sent
along with requests initiated by third party…
Cookies will only be sent in a first-party context and not be sent
along with requests initiated by third party websites.
|
#
|
public
|
ALLOWED_SAMESITE_VALUES = [self::SAMESITE_NONE, self::SAMESITE_LAX, self::SAMESITE_STRICT]
RFC 6265 allowed values for the "SameSite" attribute.
RFC 6265 allowed values for the "SameSite" attribute.
|
#
|
public
|
EXPIRES_FORMAT = 'D, d-M-Y H:i:s T'
Expires date format.
|
#
|