Provides an interace for manipulating HTTP cookies.
Create a cookie object and access its value with the value property.
Use \HotMelt\Cookie::update() to change its value and send the cookie back to the client,
or use \HotMelt\Cookie::delete() to delete the cookie.
| property-read |
The value of the cookie. Use |
|---|
__construct(string $name, string $path = '/', string $domain = null)
stringThe name of the cookie.
stringThe path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the \/foo/ directory and all sub-directories such as \/foo/bar/ of $domain. The default value is the current directory that the cookie is being set in.
stringThe domain that the cookie is available to. Setting the domain to 'www.example.com' will make the cookie available in the www subdomain and higher subdomains. Cookies available to a lower domain, such as 'example.com' will be available to higher subdomains, such as 'www.example.com'. Older browsers still implementing the deprecated RFC 2109 may require a leading . to match all subdomains.
update(mixed $value, int $time) : void
mixedThe value to set.
intThe time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the number of seconds before you want it to expire. Or you might use mktime(). time()+60*60*24*30 will set the cookie to expire in 30 days. If set to 0, or omitted, the cookie will expire at the end of the session (when the browser closes).
delete() : void
value : mixed
The value of the cookie. Use \HotMelt/Cookie::update() to change.
mixed