Cookie
in package
implements
Stringable
Class Cookie.
Tags
Table of Contents
Interfaces
- Stringable
Properties
- $domain : string|null
- $expires : DateTime|null
- $httpOnly : bool
- $name : string
- $path : string|null
- $sameSite : string|null
- $secure : bool
- $value : string
Methods
- __construct() : mixed
- Cookie constructor.
- __toString() : string
- create() : array<string, Cookie>
- Create Cookie objects from a Cookie Header line.
- getDomain() : string|null
- getExpires() : DateTime|null
- getName() : string
- getPath() : string|null
- getSameSite() : string|null
- getValue() : string
- isExpired() : bool
- isHttpOnly() : bool
- isSecure() : bool
- parse() : Cookie|null
- Parses a Set-Cookie Header line and creates a new Cookie object.
- send() : bool
- setDomain() : static
- setExpires() : static
- setHttpOnly() : static
- setPath() : static
- setSameSite() : static
- setSecure() : static
- setValue() : static
- toString() : string
- makeArgumentValue() : array<int, string|null>
- setName() : static
- trimmedOrNull() : string|null
Properties
$domain
protected
string|null
$domain
= null
$expires
protected
DateTime|null
$expires
= null
$httpOnly
protected
bool
$httpOnly
= false
$name
protected
string
$name
$path
protected
string|null
$path
= null
$sameSite
protected
string|null
$sameSite
= null
$secure
protected
bool
$secure
= false
$value
protected
string
$value
Methods
__construct()
Cookie constructor.
public
__construct(string $name, string $value) : mixed
Parameters
- $name : string
- $value : string
__toString()
public
__toString() : string
Return values
stringcreate()
Create Cookie objects from a Cookie Header line.
public
static create(string $line) : array<string, Cookie>
Parameters
- $line : string
Return values
array<string, Cookie>getDomain()
public
getDomain() : string|null
Attributes
- #[Pure]
Return values
string|nullgetExpires()
public
getExpires() : DateTime|null
Attributes
- #[Pure]
Return values
DateTime|nullgetName()
public
getName() : string
Attributes
- #[Pure]
Return values
stringgetPath()
public
getPath() : string|null
Attributes
- #[Pure]
Return values
string|nullgetSameSite()
public
getSameSite() : string|null
Attributes
- #[Pure]
Return values
string|nullgetValue()
public
getValue() : string
Attributes
- #[Pure]
Return values
stringisExpired()
public
isExpired() : bool
Return values
boolisHttpOnly()
public
isHttpOnly() : bool
Attributes
- #[Pure]
Return values
boolisSecure()
public
isSecure() : bool
Attributes
- #[Pure]
Return values
boolparse()
Parses a Set-Cookie Header line and creates a new Cookie object.
public
static parse(string $line) : Cookie|null
Parameters
- $line : string
Tags
Return values
Cookie|nullsend()
public
send() : bool
Return values
boolsetDomain()
public
setDomain(string|null $domain) : static
Parameters
- $domain : string|null
Return values
staticsetExpires()
public
setExpires(DateTime|int|string|null $expires) : static
Parameters
- $expires : DateTime|int|string|null
Tags
Return values
staticsetHttpOnly()
public
setHttpOnly([bool $httpOnly = true ]) : static
Parameters
- $httpOnly : bool = true
Return values
staticsetPath()
public
setPath(string|null $path) : static
Parameters
- $path : string|null
Return values
staticsetSameSite()
public
setSameSite(string|null $sameSite) : static
Parameters
- $sameSite : string|null
-
Strict, Lax, Unset or None
Tags
Return values
staticsetSecure()
public
setSecure([bool $secure = true ]) : static
Parameters
- $secure : bool = true
Return values
staticsetValue()
public
setValue(string $value) : static
Parameters
- $value : string
Return values
statictoString()
public
toString() : string
Tags
Return values
stringmakeArgumentValue()
protected
static makeArgumentValue(string $part) : array<int, string|null>
Parameters
- $part : string
Return values
array<int, string|null>setName()
protected
setName(string $name) : static
Parameters
- $name : string
Return values
statictrimmedOrNull()
protected
static trimmedOrNull(string $value) : string|null
Parameters
- $value : string