Provides methods like PHP's session_encode and session_decode that don't mess with $_SESSION
php-session-serializer Documentation

![Latest Stable Version] ![License]


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.

It supports the php, php_binary, and php_serialize serialize handlers. wddx is not supported, since it is inferior to php and php_binary.


// (optional) Send logs to a PSR-3 logger
PhpSessionSerializer::setLogger( $logger )
// (optional) Ensure that session.serialize_handler is set to a usable value
// Encode session data
$string = PhpSessionSerializer::encode( $array );
// Decode session data
$array = PhpSessionSerializer::decode( $string );
Provides for encoding and decoding session arrays to PHP's serialization formats.
Definition: PhpSessionSerializer.php:46

Running tests

composer install --prefer-dist
composer test


This library was created to support custom session handler read and write methods that are more useful than blindly storing the serialized data that PHP gives to custom handlers.