class Cookie
Cookie represents an HTTP cookie.
protected | $name | ||
protected | $value | ||
protected | $expires | ||
protected | $path | ||
protected | $domain | ||
protected | $secure | ||
protected | $httponly | ||
protected | $rawValue |
__construct(string $name, string|null $value, string $expires = null, string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false) Sets a cookie. | ||
__toString() Returns the HTTP representation of the Cookie. | ||
static Cookie | fromString(string $cookie, string|null $url = null) Creates a Cookie instance from a Set-Cookie header value. | |
string | getName() Gets the name of the cookie. | |
string | getValue() Gets the value of the cookie. | |
string | getRawValue() Gets the raw value of the cookie. | |
string|null | getExpiresTime() Gets the expires time of the cookie. | |
string | getPath() Gets the path of the cookie. | |
string | getDomain() Gets the domain of the cookie. | |
bool | isSecure() Returns the secure flag of the cookie. | |
bool | isHttpOnly() Returns the httponly flag of the cookie. | |
bool | isExpired() Returns true if the cookie has expired. |
Sets a cookie.
string | $name | The cookie name |
string|null | $value | The value of the cookie |
string | $expires | The time the cookie expires |
string | $path | The path on the server in which the cookie will be available on |
string | $domain | The domain that the cookie is available |
bool | $secure | Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client |
bool | $httponly | The cookie httponly flag |
bool | $encodedValue | Whether the value is encoded or not |
Returns the HTTP representation of the Cookie.
Creates a Cookie instance from a Set-Cookie header value.
string | $cookie | A Set-Cookie header value |
string|null | $url | The base URL |
Cookie |
InvalidArgumentException |
Gets the name of the cookie.
string | The cookie name |
Gets the value of the cookie.
string | The cookie value |
Gets the raw value of the cookie.
string | The cookie value |
Gets the expires time of the cookie.
string|null | The cookie expires time |
Gets the path of the cookie.
string | The cookie path |
Gets the domain of the cookie.
string | The cookie domain |
Returns the secure flag of the cookie.
bool | The cookie secure flag |
Returns the httponly flag of the cookie.
bool | The cookie httponly flag |
Returns true if the cookie has expired.
bool | true if the cookie has expired, false otherwise |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/BrowserKit/Cookie.html