Documentation

Cookie
in package
implements ArrayAccess, Countable, IteratorAggregate

Cookie class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
4.0.0

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
int

delete()

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|null

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|null
Return values
string|null

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

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
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> = []

        
On this page

Search results