Cookie
in package
implements
ArrayAccess, Countable, IteratorAggregate
Cookie class
Tags
Table of Contents
Interfaces
- ArrayAccess
- Countable
- IteratorAggregate
Properties
- $domain : string|null
- Cookie Domain
- $expires : int
- Cookie Expiration
- $httponly : bool
- Cookie HTTP Only Flag
- $instance : Cookie
- Instance of the cookie object
- $ip : string|null
- Cookie IP
- $path : string
- Cookie Path
- $samesite : string
- Cookie SameSite Flag (None, Lax, Strict)
- $secure : bool
- Cookie Secure Flag
Methods
- __get() : mixed
- Get method to return the value of the $_COOKIE global variable
- __isset() : bool
- Return the isset value of the $_COOKIE global variable
- __set() : void
- Set method to set the value of the $_COOKIE global variable
- __unset() : void
- Unset the value in the $_COOKIE global variable
- clear() : void
- Clear (delete) all cookies
- count() : int
- Method to get the count of cookie data
- delete() : void
- Delete a cookie
- getDomain() : string|null
- Return the current cookie domain
- getExpires() : int
- Return the current cookie expiration
- getInstance() : Cookie
- Determine whether or not an instance of the cookie object exists already, and instantiate the object if it does not exist.
- getIp() : string|null
- Return the current IP address.
- getIterator() : ArrayIterator
- Method to iterate over the cookie
- getOptions() : array<string|int, mixed>
- Method to create options array
- getPath() : string
- Return the current cookie path.
- getSamesite() : string
- Return if the cookie's samesite flag
- isHttpOnly() : bool
- Return if the cookie is HTTP only
- isSecure() : bool
- Return if the cookie is secure
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- set() : Cookie
- Set a cookie
- setOptions() : Cookie
- Private method to set options
- toArray() : array<string|int, mixed>
- Get the cookie values as an array
- __construct() : mixed
- Constructor
Properties
$domain
Cookie Domain
private
string|null
$domain
= null
$expires
Cookie Expiration
private
int
$expires
= 0
$httponly
Cookie HTTP Only Flag
private
bool
$httponly
= false
$instance
Instance of the cookie object
private
static Cookie
$instance
$ip
Cookie IP
private
string|null
$ip
= null
$path
Cookie Path
private
string
$path
= '/'
$samesite
Cookie SameSite Flag (None, Lax, Strict)
private
string
$samesite
= 'Lax'
$secure
Cookie Secure Flag
private
bool
$secure
= false
Methods
__get()
Get method to return the value of the $_COOKIE global variable
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
Return the isset value of the $_COOKIE global variable
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Set method to set the value of the $_COOKIE global variable
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__unset()
Unset the value in the $_COOKIE global variable
public
__unset(string $name) : void
Parameters
- $name : string
clear()
Clear (delete) all cookies
public
clear([array<string|int, mixed> $options = [] ]) : void
Parameters
- $options : array<string|int, mixed> = []
count()
Method to get the count of cookie data
public
count() : int
Return values
intdelete()
Delete a cookie
public
delete(string $name[, array<string|int, mixed> $options = [] ]) : void
Parameters
- $name : string
- $options : array<string|int, mixed> = []
getDomain()
Return the current cookie domain
public
getDomain() : string|null
Return values
string|nullgetExpires()
Return the current cookie expiration
public
getExpires() : int
Return values
intgetInstance()
Determine whether or not an instance of the cookie object exists already, and instantiate the object if it does not exist.
public
static getInstance([array<string|int, mixed> $options = [] ]) : Cookie
Parameters
- $options : array<string|int, mixed> = []
Return values
CookiegetIp()
Return the current IP address.
public
getIp() : string|null
Return values
string|nullgetIterator()
Method to iterate over the cookie
public
getIterator() : ArrayIterator
Return values
ArrayIteratorgetOptions()
Method to create options array
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getPath()
Return the current cookie path.
public
getPath() : string
Return values
stringgetSamesite()
Return if the cookie's samesite flag
public
getSamesite() : string
Return values
stringisHttpOnly()
Return if the cookie is HTTP only
public
isHttpOnly() : bool
Return values
boolisSecure()
Return if the cookie is secure
public
isSecure() : bool
Return values
booloffsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
set()
Set a cookie
public
set(string $name, mixed $value[, array<string|int, mixed> $options = [] ]) : Cookie
Parameters
- $name : string
- $value : mixed
- $options : array<string|int, mixed> = []
Return values
CookiesetOptions()
Private method to set options
public
setOptions([array<string|int, mixed> $options = [] ]) : Cookie
Parameters
- $options : array<string|int, mixed> = []
Return values
CookietoArray()
Get the cookie values as an array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>__construct()
Constructor
private
__construct([array<string|int, mixed> $options = [] ]) : mixed
Private method to instantiate the cookie object
Parameters
- $options : array<string|int, mixed> = []