class Cookie
Represents a cookie.
SAMESITE_LAX | |
SAMESITE_STRICT |
protected | $name | ||
protected | $value | ||
protected | $domain | ||
protected | $expire | ||
protected | $path | ||
protected | $secure | ||
protected | $httpOnly |
static Cookie | fromString(string $cookie, bool $decode = false) Creates cookie from raw header string. | |
__construct(string $name, string $value = null, int|string|DateTimeInterface $expire = 0, string|null $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, bool $raw = false, string $sameSite = null) | ||
string | __toString() Returns the cookie as a string. | |
string | getName() Gets the name of the cookie. | |
string|null | getValue() Gets the value of the cookie. | |
string|null | getDomain() Gets the domain that the cookie is available to. | |
int | getExpiresTime() Gets the time the cookie expires. | |
int | getMaxAge() Gets the max-age attribute. | |
string | getPath() Gets the path on the server in which the cookie will be available on. | |
bool | isSecure() Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client. | |
bool | isHttpOnly() Checks whether the cookie will be made accessible only through the HTTP protocol. | |
bool | isCleared() Whether this cookie is about to be cleared. | |
bool | isRaw() Checks if the cookie value should be sent with no url encoding. | |
string|null | getSameSite() Gets the SameSite attribute. |
Creates cookie from raw header string.
string | $cookie | |
bool | $decode |
Cookie |
string | $name | The name of the cookie |
string | $value | The value of the cookie |
int|string|DateTimeInterface | $expire | The time the cookie expires |
string|null | $path | The path on the server in which the cookie will be available on |
string | $domain | The domain that the cookie is available to |
bool | $secure | Whether the cookie should only be transmitted over a secure HTTPS connection from the client |
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 | $sameSite | Whether the cookie will be available for cross-site requests |
InvalidArgumentException |
Returns the cookie as a string.
string | The cookie |
Gets the name of the cookie.
string |
Gets the value of the cookie.
string|null |
Gets the domain that the cookie is available to.
string|null |
Gets the time the cookie expires.
int |
Gets the max-age attribute.
int |
Gets the path on the server in which the cookie will be available on.
string |
Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client.
bool |
Checks whether the cookie will be made accessible only through the HTTP protocol.
bool |
Whether this cookie is about to be cleared.
bool |
Checks if the cookie value should be sent with no url encoding.
bool |
Gets the SameSite attribute.
string|null |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpFoundation/Cookie.html