\ptejada\uFlexCookie

Class handles a single cookie Reads and writes the value of a cookie

Summary

Methods
Properties
Constants
__construct()
setLifetime()
setPath()
setHost()
add()
destroy()
getValue()
setValue()
$log
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$name
$value
$lifetime
$path
$host
N/A

Properties

$name

$name : string

Type

string — The name of the cookie

$value

$value : string

Type

string — The content of the cookie

$lifetime

$lifetime : int

Type

int — The lifetime in days of the cookie

$path

$path : string

Type

string — The path of the cookie

$host

$host : string

Type

string — The host for which the host belongs to

Methods

__construct()

__construct(string $name, string $value, int $lifetime, string $path, null $host)

Initializes a cookie

Parameters

string $name

The name of the cookie

string $value

(optional) The content of the cookie

int $lifetime

(optional) The lifetime in days of the cookie

string $path

(optional) The URL path of the cookie

null $host

(optional) The host for which the host belongs to

setLifetime()

setLifetime(int $lifetime)

Set the lifetime of the cookie

Parameters

int $lifetime
  • The number of days to last

setPath()

setPath(string $path)

Set the path of the cookie relative to the site domain

Parameters

string $path
  • The path of the cookie

setHost()

setHost(string $host)

Set the host to add the cookie for

Parameters

string $host

add()

add() : bool

Sends the cookie to the browser

Returns

bool

destroy()

destroy() : bool

Destroys the cookie

Returns

bool

getValue()

getValue() : null|mixed

Get the value of the cookie

Returns

null|mixed —
  • Returns null if the cookie does not exists

setValue()

setValue(string $value)

Sets the value for

Parameters

string $value