$name
$name : string
Cookie name
Cookie object to build a cookie and turn it into a header value
An HTTP cookie (also called web cookie, Internet cookie, browser cookie or simply cookie) is a small piece of data sent from a website and stored on the user's computer by the user's web browser while the user is browsing.
Cookies were designed to be a reliable mechanism for websites to remember stateful information (such as items added in the shopping cart in an online store) or to record the user's browsing activity (including clicking particular buttons, logging in, or recording which pages were visited in the past). They can also be used to remember arbitrary pieces of information that the user previously entered into form fields such as names, and preferences.
Cookie objects are immutable, and you must re-assign variables when modifying cookie objects:
$cookie = $cookie->withValue('0');
__construct(string $name, string|array $value = '', \DateTime|\DateTimeImmutable|null $expiresAt = null, string $path = '/', string $domain = '', boolean $secure = false, boolean $httpOnly = false)
Constructor
The constructors args are similar to the native PHP setcookie()
method.
The only difference is the 3rd argument which excepts null or an
DateTime or DateTimeImmutable object instead an integer.
string | $name | Cookie name |
string|array | $value | Value of the cookie |
\DateTime|\DateTimeImmutable|null | $expiresAt | Expiration time and date |
string | $path | Path |
string | $domain | Domain |
boolean | $secure | Is secure |
boolean | $httpOnly | HTTP Only |
_expand(string $string) : string|array
Explode method to return array from string set in CookieComponent::_flatten() Maintains reading backwards compatibility with 1.x CookieComponent::_flatten().
string | $string | A string containing JSON encoded data, or a bare string. |
Map of key and values