withName() withName(string $name) : static Sets the cookie name Parameters string $name Name of the cookie Returns static
getStringValue() getStringValue() : string Gets the cookie value as a string. This will collapse any complex data in the cookie with json_encode() Returns string
withValue() withValue(string|array $value) : static Create a cookie with an updated value. Parameters string|array $value Value of the cookie to set Returns static
getId() getId() : string Get the id for a cookie Cookies are unique across name, domain, path tuples. Returns string
withPath() withPath(string $path) : static Create a new cookie with an updated path Parameters string $path Sets the path Returns static
withDomain() withDomain(string $domain) : static Create a cookie with an updated domain Parameters string $domain Domain to set Returns static
getExpiry() getExpiry() : \DateTime|\DateTimeImmutable|null Get the current expiry time Returns \DateTime|\DateTimeImmutable|null — Timestamp of expiry or null
getExpiresTimestamp() getExpiresTimestamp() : string|null Get the timestamp from the expiration time Timestamps are strings as large timestamps can overflow MAX_INT in 32bit systems. Returns string|null — The expiry time as a string timestamp.
getFormattedExpires() getFormattedExpires() : string Builds the expiration value part of the header string Returns string
withExpiry() withExpiry(\DateTime|\DateTimeImmutable $dateTime) : static Create a cookie with an updated expiration date Parameters \DateTime|\DateTimeImmutable $dateTime Date time object Returns static
withNeverExpire() withNeverExpire() : static Create a new cookie that will virtually never expire. Returns static
withExpired() withExpired() : static Create a new cookie that will expire/delete the cookie from the browser. This is done by setting the expiration time to 1 year ago Returns static
isExpired() isExpired(\DateTime|\DateTimeImmutable $time = null) : boolean Check if a cookie is expired when compared to $time Cookies without an expiration date always return false. Parameters \DateTime|\DateTimeImmutable $time The time to test against. Defaults to 'now' in UTC. Returns boolean
withHttpOnly() withHttpOnly(boolean $httpOnly) : static Create a cookie with HTTP Only updated Parameters boolean $httpOnly HTTP Only Returns static
withSecure() withSecure(boolean $secure) : static Create a cookie with Secure updated Parameters boolean $secure Secure attribute value Returns static