Documentation

cookie

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
mixed

set()

Set cookie value

public set( $value : string ) : bool
Parameters
$value : string
Return values
bool

setExpires()

Set expiration time

public setExpires( $expires : int ) : $this
Parameters
$expires : int
Return values
$this

setPath()

Set cookie path

public setPath( $path : string ) : $this
Parameters
$path : string
Return values
$this

setDomain()

Set cookie domain

public setDomain( $domain : string ) : $this
Parameters
$domain : string
Return values
$this

setSamesite()

Set Same-site policy

public setSamesite( $samesite : string ) : $this
Parameters
$samesite : string
Return values
$this

setSecure()

Set cookie is only available via HTTPS

public setSecure( $secure : bool ) : $this
Parameters
$secure : bool
Return values
$this

setHttponly()

Set cookie is not available via Javascript

public setHttponly( $httponly : bool ) : $this
Parameters
$httponly : bool
Return values
$this

Search results