Documentation

cookie
in package

Cookie setter onject

Tags
author

Stefan Seehafer sea75300@yahoo.de

copyright

(c) 2020, Stefan Seehafer

license

http://www.gnu.org/licenses/gpl.txt GPLv3

since
4.5

Table of Contents

$flags  : array<string|int, mixed>
setcookie flags
$legacySet  : bool
Use legacy mode to set cookie
$name  : string
cookie value
__construct()  : mixed
Constructor
set()  : bool
Set cookie value
setDomain()  : $this
Set cookie domain
setExpires()  : $this
Set expiration time
setHttponly()  : $this
Set cookie is not available via Javascript
setPath()  : $this
Set cookie path
setSamesite()  : $this
Set Same-site policy
setSecure()  : $this
Set cookie is only available via HTTPS

Properties

$flags

setcookie flags

private array<string|int, mixed> $flags = ['expires' => 3600, 'path' => '/', 'domain' => '', 'samesite' => 'Lax', 'secure' => false, 'httponly' => true]

$legacySet

Use legacy mode to set cookie

private bool $legacySet = false

$name

cookie value

private string $name = ''

Methods

__construct()

Constructor

public __construct(string $name) : mixed
Parameters
$name : string
Return values
mixed

set()

Set cookie value

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

setDomain()

Set cookie domain

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

setExpires()

Set expiration time

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

setHttponly()

Set cookie is not available via Javascript

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

setPath()

Set cookie path

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

setSamesite()

Set Same-site policy

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

setSecure()

Set cookie is only available via HTTPS

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

Search results