php-session-serializer

From MediaWiki.org
Jump to navigation Jump to search

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 );

External links[edit]