Documentation

Cookie
in package
implements ArrayAccess, Countable, IteratorAggregate

Cookie class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.3.0

Interfaces, Classes, Traits and Enums

ArrayAccess
Countable
IteratorAggregate

Table of Contents

$domain  : string
Cookie Domain
$expires  : int
Cookie Expiration
$httponly  : bool
Cookie HTTP Only Flag
$instance  : Cookie
Instance of the cookie object
$ip  : string
Cookie IP
$path  : string
Cookie Path
$samesite  : bool
Cookie SameSite Flag (None, Lax, Strict)
$secure  : bool
Cookie Secure Flag
__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
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
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 $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 $ip = null

$path

Cookie Path

private string $path = '/'

$samesite

Cookie SameSite Flag (None, Lax, Strict)

private bool $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
Return values
mixed

__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
Return values
void

__unset()

Unset the value in the $_COOKIE global variable

public __unset(string $name) : void
Parameters
$name : string
Return values
void

clear()

Clear (delete) all cookies

public clear([array<string|int, mixed> $options = null ]) : void
Parameters
$options : array<string|int, mixed> = null
Return values
void

count()

Method to get the count of cookie data

public count() : int
Return values
int

delete()

Delete a cookie

public delete(string $name[, array<string|int, mixed> $options = null ]) : void
Parameters
$name : string
$options : array<string|int, mixed> = null
Return values
void

getDomain()

Return the current cookie domain

public getDomain() : string
Return values
string

getExpires()

Return the current cookie expiration

public getExpires() : int
Return values
int

getInstance()

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
Cookie

getIp()

Return the current IP address.

public getIp() : string
Return values
string

getIterator()

Method to iterate over the cookie

public getIterator() : ArrayIterator
Return values
ArrayIterator

getOptions()

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
string

getSamesite()

Return if the cookie's samesite flag

public getSamesite() : string
Return values
string

isHttpOnly()

Return if the cookie is HTTP only

public isHttpOnly() : bool
Return values
bool

isSecure()

Return if the cookie is secure

public isSecure() : bool
Return values
bool

offsetExists()

ArrayAccess offsetExists

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

ArrayAccess offsetGet

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed

offsetSet()

ArrayAccess offsetSet

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed
Return values
void

offsetUnset()

ArrayAccess offsetUnset

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Return values
void

set()

Set a cookie

public set(string $name, mixed $value[, array<string|int, mixed> $options = null ]) : Cookie
Parameters
$name : string
$value : mixed
$options : array<string|int, mixed> = null
Return values
Cookie

setOptions()

Private method to set options

public setOptions([array<string|int, mixed> $options = [] ]) : Cookie
Parameters
$options : array<string|int, mixed> = []
Return values
Cookie

toArray()

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> = []
Return values
mixed

Search results