Session storage in $_SESSION

Replaces the $_SESSION superglobal with an ArrayObject that allows for property access, metadata storage, locking, and immutability.

package Default

 Methods

Constructor

__construct(array|null $input = null

Parameters

$input

arraynull

Destructor

__destruct() : void

Get Offset

__get(mixed $key) : mixed

Parameters

$key

mixed

Returns

mixed

Isset Offset

__isset(mixed $key) : boolean

Parameters

$key

mixed

Returns

boolean

Set Offset

__set(mixed $key, mixed $value) : void

Parameters

$key

mixed

$value

mixed

Unset Offset

__unset(mixed $key) : void

Parameters

$key

mixed

Clear the storage object or a subkey of the object

clear(null|integer|string $key = null) : \Zend\Session\Storage\ArrayStorage
inherited_from \Zend\Session\Storage\StorageInterface::clear()

Parameters

$key

nullintegerstring

Exceptions

\Zend\Session\Exception\RuntimeException

Returns

\Zend\Session\Storage\ArrayStorage

Count

count() : integer

Returns

integer

Load session object from an existing array

fromArray(array $array) : \Zend\Session\Storage\SessionStorage

Ensures $_SESSION is set to an instance of the object when complete.

inherited_from \Zend\Session\Storage\StorageInterface::fromArray()

Parameters

$array

array

Returns

\Zend\Session\Storage\SessionStorage

Get Iterator

getIterator() : \ArrayIterator

Returns

\ArrayIterator

Retrieve the request access time

getRequestAccessTime() : float
inherited_from \Zend\Session\Storage\StorageInterface::getRequestAccessTime()

Returns

float

Initialize Storage

init(array $input = null) : void
inherited_from \Zend\Session\Storage\StorageInitializationInterface::init()

Parameters

$input

array

Determine if this object is isImmutable

isImmutable() : boolean
inherited_from \Zend\Session\Storage\StorageInterface::isImmutable()

Returns

boolean

Is the object or key marked as locked?

isLocked(null|integer|string $key = null) : boolean
inherited_from \Zend\Session\Storage\StorageInterface::isLocked()

Parameters

$key

nullintegerstring

Returns

boolean

Lock this storage instance, or a key within it

lock(null|integer|string $key = null) : \Zend\Session\Storage\ArrayStorage
inherited_from \Zend\Session\Storage\StorageInterface::lock()

Parameters

$key

nullintegerstring

Returns

\Zend\Session\Storage\ArrayStorage

Mark object as isImmutable

markImmutable() : \Zend\Session\Storage\SessionStorage
inherited_from \Zend\Session\Storage\StorageInterface::markImmutable()

Returns

\Zend\Session\Storage\SessionStorage

Offset Exists

offsetExists(mixed $key) : boolean

Parameters

$key

mixed

Returns

boolean

Offset Get

offsetGet(mixed $key) : mixed

Parameters

$key

mixed

Returns

mixed

Offset Set

offsetSet(mixed $key, mixed $value) : void

Parameters

$key

mixed

$value

mixed

Offset Unset

offsetUnset(mixed $key) : void

Parameters

$key

mixed

Seralize

serialize() : string

Returns

string

Cast the object to an array

toArray(boolean $metaData = false) : array
inherited_from \Zend\Session\Storage\StorageInterface::toArray()

Parameters

$metaData

boolean

Whether to include metadata

Returns

array

Unlock an object or key marked as locked

unlock(null|integer|string $key = null) : \Zend\Session\Storage\ArrayStorage
inherited_from \Zend\Session\Storage\StorageInterface::unlock()

Parameters

$key

nullintegerstring

Returns

\Zend\Session\Storage\ArrayStorage

Unserialize

unserialize(string $session) : mixed

Parameters

$session

string

Returns

mixed

Set the request access time

setRequestAccessTime(float $time) : \Zend\Session\Storage\ArrayStorage

Parameters

$time

float

Returns

\Zend\Session\Storage\ArrayStorage