PHP Mini Documentation

Cookies extends Attribute
in package

PHP Mini Framework

Tags
copyright

busarm.com

license

https://github.com/Busarm/php-mini/blob/master/LICENSE (MIT License)

link
https://github.com/josantonius/php-session

Table of Contents

$attributes  : array<string|int, mixed>
$onChange  : Closure|null
$onDelete  : Closure|null
$encrypt  : bool
$id  : string
$options  : array<string|int, mixed>
$prefix  : string
__construct()  : mixed
__toString()  : string
Gets a string representation of the object
all()  : array<string|int, mixed>
Get all attributes
clear()  : void
Remove all attribute
get()  : mixed
Get attribute
has()  : bool
Checks if an attribute exists
load()  : self
Load cookies
mirror()  : self
Mirror attributes with external source
onChange()  : self
Set on attribute change listner
onDelete()  : self
Set on attribute delete listner
pull()  : mixed
Pull attribute: Get and delete
remove()  : void
Remove attribute
replace()  : void
Set bulk attributes
set()  : bool
Set attribute

Properties

$attributes

protected array<string|int, mixed> $attributes = []
Tags

$onChange

protected Closure|null $onChange = null
Tags

$onDelete

protected Closure|null $onDelete = null
Tags

$encrypt

private bool $encrypt = true
Tags

$options

private array<string|int, mixed> $options = []
Tags

$prefix

private string $prefix = ''
Tags

Methods

__construct()

public __construct([array<string|int, mixed> $options = [] ][, bool $encrypt = true ][, string $id = '' ][, string $prefix = '' ]) : mixed
Parameters
$options : array<string|int, mixed> = []

Cookies config options List of available $options with their default values:

  • domain: ""
  • httponly: "0"
  • expires: "0" (seconds)
  • path: "/"
  • samesite: ""
  • secure: "0"
$encrypt : bool = true

Encrypt Cookies

$id : string = ''

Unique id for Encrypted cookie. Use to bind cookies to specific user. E.g Ip address

$prefix : string = ''

Prefix for cookies

Tags
Return values
mixed

__toString()

Gets a string representation of the object

public __toString() : string
Tags
Return values
string

Returns the string representation of the object.

all()

Get all attributes

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

clear()

Remove all attribute

public clear() : void
Tags
Return values
void

get()

Get attribute

public get(string $name[, mixed $default = null ]) : mixed
Parameters
$name : string
$default : mixed = null
Tags
Return values
mixed

has()

Checks if an attribute exists

public has(string $name) : bool
Parameters
$name : string
Tags
Return values
bool

load()

Load cookies

public load(mixed $cookies) : self
Parameters
$cookies : mixed
Tags
Return values
self

mirror()

Mirror attributes with external source

public mirror(mixed &$attributes) : self
Parameters
$attributes : mixed
Tags
Return values
self

onChange()

Set on attribute change listner

public onChange(Closure $onChange) : self
Parameters
$onChange : Closure
Return values
self

onDelete()

Set on attribute delete listner

public onDelete(Closure $onDelete) : self
Parameters
$onDelete : Closure
Return values
self

pull()

Pull attribute: Get and delete

public pull(string $name[, mixed $default = null ]) : mixed
Parameters
$name : string
$default : mixed = null
Tags
Return values
mixed

remove()

Remove attribute

public remove(string $name) : void
Parameters
$name : string
Tags
Return values
void

replace()

Set bulk attributes

public replace(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Tags
Return values
void

set()

Set attribute

public set(string $name, mixed $value[, mixed $options = NULL ]) : bool
Parameters
$name : string
$value : mixed
$options : mixed = NULL
Tags
Return values
bool

        

Search results