cookie
in
Cookie setter onject
Table of Contents
$name | cookie value | string |
---|---|---|
$flags | setcookie flags | array |
$legacySet | Use legacy mode to set cookie | bool |
__construct() | Constructor | mixed |
set() | Set cookie value | bool |
setExpires() | Set expiration time | $this |
setPath() | Set cookie path | $this |
setDomain() | Set cookie domain | $this |
setSamesite() | Set Same-site policy | $this |
setSecure() | Set cookie is only available via HTTPS | $this |
setHttponly() | Set cookie is not available via Javascript | $this |
Properties
$name
cookie value
private
string
$name
= ''
$flags
setcookie flags
private
array
$flags
= ['expires' => 3600, 'path' => '/', 'domain' => '', 'samesite' => 'Lax', 'secure' => false, 'httponly' => true]
$legacySet
Use legacy mode to set cookie
private
bool
$legacySet
= false
Methods
__construct()
Constructor
public
__construct(
$name :
string
)
: mixed
Parameters
- $name : string
Return values
mixedset()
Set cookie value
public
set(
$value :
string
)
: bool
Parameters
- $value : string
Return values
boolsetExpires()
Set expiration time
public
setExpires(
$expires :
int
)
: $this
Parameters
- $expires : int
Return values
$thissetPath()
Set cookie path
public
setPath(
$path :
string
)
: $this
Parameters
- $path : string
Return values
$thissetDomain()
Set cookie domain
public
setDomain(
$domain :
string
)
: $this
Parameters
- $domain : string
Return values
$thissetSamesite()
Set Same-site policy
public
setSamesite(
$samesite :
string
)
: $this
Parameters
- $samesite : string
Return values
$thissetSecure()
Set cookie is only available via HTTPS
public
setSecure(
$secure :
bool
)
: $this
Parameters
- $secure : bool
Return values
$thissetHttponly()
Set cookie is not available via Javascript
public
setHttponly(
$httponly :
bool
)
: $this
Parameters
- $httponly : bool