Class SetCookie

Summary

Fully Qualified Name: Laminas\Http\Header\SetCookie
Implements: MultipleHeaderInterface

Description

Methods

Name Description Defined By
__construct() Cookie object constructor SetCookie
fromString() SetCookie
getDomain() SetCookie
getEncodeValue() SetCookie
getExpires() SetCookie
getFieldName() SetCookie
getFieldValue() SetCookie
getMaxAge() SetCookie
getName() SetCookie
getPath() SetCookie
getSameSite() SetCookie
getValue() SetCookie
getVersion() SetCookie
hasQuoteFieldValue() Check whether the value for this cookie should be quoted SetCookie
isExpired() Check whether the cookie has expired SetCookie
isHttponly() SetCookie
isSecure() SetCookie
isSessionCookie() Check whether the cookie is a session cookie (has no expiry time set) SetCookie
isValidForRequest() SetCookie
match() Checks whether the cookie should be sent or not in a specific scenario SetCookie
matchCookieDomain() Check if a cookie's domain matches a host name. SetCookie
matchCookiePath() Check if a cookie's path matches a URL path SetCookie
setDomain() SetCookie
setEncodeValue() SetCookie
setExpires() SetCookie
setHttponly() SetCookie
setMaxAge() SetCookie
setName() SetCookie
setPath() SetCookie
setQuoteFieldValue() Set whether the value for this cookie should be quoted SetCookie
setSameSite() SetCookie
setSecure() SetCookie
setValue() SetCookie
setVersion() SetCookie
toString() SetCookie
toStringMultipleHeaders() SetCookie

Method Details

__construct()

Cookie object constructor

Parameter Name Type Description
$name string|null
$value string|null
$expires int|string|\DateTime|null
$path string|null
$domain string|null
$secure bool
$httponly bool
$maxAge int|null
$version int|null
$sameSite string|null

Returns:

fromString()

Parameter Name Type Description
$headerLine
$bypassHeaderFieldName bool
$headerLine

Returns: array|\SetCookie

getDomain()

Returns: string|null

getEncodeValue()

Returns: bool

getExpires()

Parameter Name Type Description
$inSeconds bool

Returns: int|string|null

getFieldName()

Returns: string 'Set-Cookie'

getFieldValue()

Returns: string

getMaxAge()

Returns: int|null

getName()

Returns: string|null

getPath()

Returns: string|null

getSameSite()

Returns: string|null

getValue()

Returns: string|null

getVersion()

Returns: int|null

hasQuoteFieldValue()

Check whether the value for this cookie should be quoted

Returns: bool

isExpired()

Check whether the cookie has expired

Always returns false if the cookie is a session cookie (has no expiry time)

Parameter Name Type Description
$now int|null Timestamp

Returns: bool

isHttponly()

Returns: bool|null

isSecure()

Returns: bool|null

isSessionCookie()

Check whether the cookie is a session cookie (has no expiry time set)

Returns: bool

isValidForRequest()

Parameter Name Type Description
$requestDomain string
$path string
$isSecure bool

Returns: bool

match()

Checks whether the cookie should be sent or not in a specific scenario

Parameter Name Type Description
$uri string|\Laminas\Uri\Uri URI
$matchSessionCookies bool Whether
$now int|null Override

Returns: bool

matchCookieDomain()

Check if a cookie's domain matches a host name.

Used by Laminas\Http\Cookies for cookie matching

Parameter Name Type Description
$cookieDomain string
$host string

Returns: bool

matchCookiePath()

Check if a cookie's path matches a URL path

Used by Laminas\Http\Cookies for cookie matching

Parameter Name Type Description
$cookiePath string
$path string

Returns: bool

setDomain()

Parameter Name Type Description
$domain string|null

Returns: $this

setEncodeValue()

Parameter Name Type Description
$encodeValue bool

Returns:

setExpires()

Parameter Name Type Description
$expires int|string|\DateTime|null

Returns: $this

setHttponly()

Parameter Name Type Description
$httponly bool|null

Returns: $this

setMaxAge()

Parameter Name Type Description
$maxAge int

Returns: $this

setName()

Parameter Name Type Description
$name string|null

Returns: $this

setPath()

Parameter Name Type Description
$path string|null

Returns: $this

setQuoteFieldValue()

Set whether the value for this cookie should be quoted

Parameter Name Type Description
$quotedValue bool

Returns: $this

setSameSite()

Parameter Name Type Description
$sameSite string|null

Returns: $this

setSecure()

Parameter Name Type Description
$secure bool|null

Returns: $this

setValue()

Parameter Name Type Description
$value string|null

Returns: $this

setVersion()

Parameter Name Type Description
$version int|null

Returns: $this

toString()

Returns: string

toStringMultipleHeaders()

Parameter Name Type Description
$headers array

Returns: string

Top