Download the PHP package session-interop/utils.arraysession without Composer
On this page you can find all versions of the php package session-interop/utils.arraysession. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download session-interop/utils.arraysession
More information about session-interop/utils.arraysession
Files in session-interop/utils.arraysession
Package utils.arraysession
Short Description This package contains the session interface implementation
License MIT
Homepage https://github.com/session-interop/utils.session
Informations about the package utils.arraysession
Array Session
This package is a basic implementation of SessionInterface
Installation
You can install this package through Composer:
The packages adheres to the SemVer specification, and there will be full backward compatibility between minor versions.
Available
SessionArray
.
The implementation of SessionInterface.
Methods
__construct(&$array, $prefix = "")
Construct the object. The object will use $array to store element. It use a reference on $array, so $array will be modified when you use set($key)
and remove($key)
.
If prefix is given, it will automatically prefix all $key
.
has($key)
Verify is the key $key
exists into the array injected at the object construction. Throw an exception if the key
is not a string. if the associated value is null
, the method return true
.
get($key)
Get the value associated with $key
. Throw an exception if no key are found or if the key is not a string
set($key, $val)
Set the value $val
at the key $key
. Throw an exception if the key is not a string.
remove($key)
Destroy the element at $key
SessionException
.
Exception used on error. Throw an exception if the key is not a string
Usage
Writing an user service that use the session interface:
UserService.php
Use the implementation:
Index.php