VuFind API Documentation

CookieManager
in package

Cookie Manager

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Ere Maijala ere.maijala@helsinki.fi

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$cookies  : array<string|int, mixed>
Cookie array to work with
$domain  : string
Cookie domain
$httpOnly  : bool
Are cookies HTTP only?
$path  : string
Cookie base path
$sameSite  : string
Default SameSite attribute
$secure  : bool
Are cookies secure only?
$sessionName  : string|null
The name of the session cookie
__construct()  : mixed
Constructor
clear()  : bool
Clear a cookie.
get()  : mixed
Retrieve a cookie value (or null if unset).
getCookies()  : array<string|int, mixed>
Get all cookie values.
getDomain()  : string
Get the cookie domain.
getPath()  : string
Get the cookie path.
getSameSite()  : string
Get the cookie SameSite attribute.
getSessionName()  : string|null
Get the name of the cookie
isHttpOnly()  : bool
Are cookies set to "HTTP only" mode?
isSecure()  : bool
Are cookies set to "secure only" mode?
proxySetCookie()  : bool
Support method for setGlobalCookie -- proxy PHP's setcookie() function for compatibility with unit testing.
set()  : bool
Set a cookie.
setGlobalCookie()  : bool
Support method for set() -- set the actual cookie in PHP.

Properties

$cookies

Cookie array to work with

protected array<string|int, mixed> $cookies

$sameSite

Default SameSite attribute

protected string $sameSite

$sessionName

The name of the session cookie

protected string|null $sessionName

Methods

__construct()

Constructor

public __construct(array<string|int, mixed> $cookies[, string $path = '/' ][, string $domain = null ][, bool $secure = false ][, string|null $sessionName = null ][, bool $httpOnly = true ][, string $sameSite = 'Lax' ]) : mixed
Parameters
$cookies : array<string|int, mixed>

Cookie array to manipulate (e.g. $_COOKIE)

$path : string = '/'

Cookie base path (default = /)

$domain : string = null

Cookie domain

$secure : bool = false

Are cookies secure only? (default = false)

$sessionName : string|null = null

Session cookie name (if null defaults to PHP settings)

$httpOnly : bool = true

Are cookies HTTP only? (default = true)

$sameSite : string = 'Lax'

Default SameSite attribute (defaut = 'Lax')

Return values
mixed

clear()

Clear a cookie.

public clear(string $key) : bool
Parameters
$key : string

Name of cookie to unset

Return values
bool

get()

Retrieve a cookie value (or null if unset).

public get(string $key) : mixed
Parameters
$key : string

Name of cookie to retrieve

Return values
mixed

getCookies()

Get all cookie values.

public getCookies() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDomain()

Get the cookie domain.

public getDomain() : string
Return values
string

getPath()

Get the cookie path.

public getPath() : string
Return values
string

getSameSite()

Get the cookie SameSite attribute.

public getSameSite() : string
Return values
string

getSessionName()

Get the name of the cookie

public getSessionName() : string|null
Return values
string|null

isHttpOnly()

Are cookies set to "HTTP only" mode?

public isHttpOnly() : bool
Return values
bool

isSecure()

Are cookies set to "secure only" mode?

public isSecure() : bool
Return values
bool

proxySetCookie()

Support method for setGlobalCookie -- proxy PHP's setcookie() function for compatibility with unit testing.

public proxySetCookie(string $key, mixed $value, int $expire, string $path, string $domain, bool $secure, bool $httpOnly, string $sameSite) : bool
Parameters
$key : string

Name of cookie to set

$value : mixed

Value to set

$expire : int

Cookie expiration time

$path : string

Path

$domain : string

Domain

$secure : bool

Whether the cookie is secure only

$httpOnly : bool

Whether the cookie should be "HTTP only"

$sameSite : string

SameSite attribute to use (Lax, Strict or None)

Return values
bool

set()

Set a cookie.

public set(string $key, mixed $value, int $expire[, null|bool $httpOnly = null ][, string $sameSite = null ]) : bool
Parameters
$key : string

Name of cookie to set

$value : mixed

Value to set

$expire : int

Cookie expiration time

$httpOnly : null|bool = null

Whether the cookie should be "HTTP only"

$sameSite : string = null

SameSite attribute to use (Lax, Strict or None)

Return values
bool

setGlobalCookie()

Support method for set() -- set the actual cookie in PHP.

public setGlobalCookie(string $key, mixed $value, int $expire[, null|bool $httpOnly = null ][, string $sameSite = null ]) : bool
Parameters
$key : string

Name of cookie to set

$value : mixed

Value to set

$expire : int

Cookie expiration time

$httpOnly : null|bool = null

Whether the cookie should be "HTTP only"

$sameSite : string = null

SameSite attribute to use (Lax, Strict or None)

Return values
bool

Search results