Jump to content

php-session-serializer

From mediawiki.org

php-session-serializer is a PHP library that provides methods that work like PHP's session_encode and session_decode functions but don't mess with the $_SESSION superglobal.

Usage

[edit]
use Wikimedia\PhpSessionSerializer;

// (optional) Send logs to a PSR-3 logger
PhpSessionSerializer::setLogger( $logger );

// (optional) Ensure that session.serialize_handler is set to a usable value
PhpSessionSerializer::setSerializeHandler();

// Encode session data
$string = PhpSessionSerializer::encode( $array );

// Decode session data
$array = PhpSessionSerializer::decode( $string );
[edit]