hs-php-session-0.0.9.1: PHP session and values serialization

Copyright(c) 2013-2014 Edward Blake
LicenseBSD-style
MaintainerEdward L. Blake <edwardlblake@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.PHPSession

Contents

Description

Encodes and decodes serialized PHP sessions in the format used by the "php" setting for session.serialize_handler.

Synopsis

Decode from ByteString

decodePHPSession :: ByteString -> Maybe PHPSessionVariableList Source

Decodes a ByteString containing a serialization of a list of session variables using the "php" session serialization format into a PHPSessionVariableList

decodePHPSessionValue :: ByteString -> Maybe PHPSessionValue Source

Decodes a ByteString containing a session serialization of a value into a PHPSessionValue. The format being decoded is similar if not probably the same format used by PHP's serialize/unserialize functions. Nothing is returned if the input bytestring could not be parsed correctly.

Encode to ByteString

encodePHPSession :: PHPSessionVariableList -> ByteString Source

Encode a PHPSessionVariableList into a ByteString containing the serialization of a list of session variables using the "php" session serialization format.

encodePHPSessionValue :: PHPSessionValue -> ByteString Source

Encode a PHPSessionValue into a ByteString containing the serialization of a PHP value. The format being encoded into is similar if not probably the same format used by PHP's serialize/unserialize functions.

Decode only part of a ByteString

decodePartialPHPSessionValue :: ByteString -> Maybe (PHPSessionValue, ByteString) Source

Decodes as much of a ByteString as needed into a PHPSessionValue and returns the rest of the string. Decoding ends at either the end of the string or when the extent of the current nested structure is met when an extra closing curly brace is encountered. The format being decoded is similar if not probably the same format used by PHP's serialize/unserialize functions. Nothing is returned if the input bytestring could not be parsed correctly.

PHP session types

type PHPSessionVariableList = [(ByteString, PHPSessionValue)] Source

Holds the "top-level" session variables and their value contents.

data PHPSessionClassName Source

Represents the name of a PHP class.

data PHPSessionValue Source

PHPSessionValue Represents a PHP value, which may be a number, string, array, object, boolean, null, or references.

data PHPSessionAttr Source

PHPSessionAttr are values associated with PHPSessionValueMisc to inspect and generally re-encode the necessary information for that value.