Cookie.php
system/Cookie/Cookie.php
1 class
41 methods
class Cookie
A `Cookie` class represents an immutable HTTP cookie value object. Being immutable, modifying one or more of its attributes will return a new `Cookie` instance, rather than modifying itself. Users should reassign this new instance to a new variable to capture it. ```php $cookie = new Cookie('test_cookie', 'test_value'); $cookie->getName(); // test_cookie $cookie->withName('prod_cookie'); $cookie->getName(); // test_cookie $cookie2 = $cookie->withName('prod_cookie'); $cookie2->getName(); // prod_cookie ```
setDefaults
($config = [])
fromHeaderString
(string $cookie, bool $raw = false)
__construct
(string $name, string $value = '', array $options = [])
getId
()
getPrefix
()
getName
()
getPrefixedName
()
getValue
()
getExpiresTimestamp
()
getExpiresString
()
isExpired
()
getMaxAge
()
getPath
()
getDomain
()
isSecure
()
isHTTPOnly
()
getSameSite
()
isRaw
()
getOptions
()
withPrefix
(string $prefix = '')
withName
(string $name)
withValue
(string $value)
withExpires
($expires)
withExpired
()
withPath
(?string $path)
withDomain
(?string $domain)
withSecure
(bool $secure = true)
withHTTPOnly
(bool $httponly = true)
withSameSite
(string $samesite)
withRaw
(bool $raw = true)
offsetExists
($offset)
offsetGet
($offset)
offsetSet
($offset, $value)
offsetUnset
($offset)
toHeaderString
()
__toString
()
toArray
()
convertExpiresTimestamp
($expires = 0)
validateName
(string $name, bool $raw)
validatePrefix
(string $prefix, bool $secure, string $path, string $domain)
validateSameSite
(string $samesite, bool $secure)