Documentation

Horde_Pack
in package

A replacement for serialize()/json_encode() that will automatically use the most efficient serialization available based on the input.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2013-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

COMPRESS_MASK  = 64
DEFAULT_COMPRESS  = 128
$_compress  : Horde_Compress_Fast
Instance of Horde_Compress_Fast shared between all instances.
$_drivers  : array<string|int, mixed>
Drivers. Shared between all instances.
__construct()  : mixed
Constructor.
__sleep()  : mixed
pack()  : string
Pack a string.
unpack()  : mixed
Unpack a string.

Constants

COMPRESS_MASK

public mixed COMPRESS_MASK = 64

DEFAULT_COMPRESS

public mixed DEFAULT_COMPRESS = 128

Properties

$_compress

Instance of Horde_Compress_Fast shared between all instances.

protected static Horde_Compress_Fast $_compress

$_drivers

Drivers. Shared between all instances.

protected static array<string|int, mixed> $_drivers = array()

Methods

__construct()

Constructor.

public __construct() : mixed
Return values
mixed

__sleep()

public __sleep() : mixed
Return values
mixed

pack()

Pack a string.

public pack(mixed $data[, array<string|int, mixed> $opts = array() ]) : string
Parameters
$data : mixed

The data to pack.

$opts : array<string|int, mixed> = array()

Additional options:

  - compress: (mixed) If false, don't use compression. If true, uses
              default compress length (DEFAULT). If 0, always compress.
              All other integer values: compress only if data is
              greater than this string length.
  - drivers: (array) Only use these drivers to pack. By default, driver
             to use is auto-determined.
  - phpob: (boolean) If true, the data contains PHP serializable
           objects (i.e. objects that have a PHP-specific serialized
           representation). If false, the data does not contain any of
           these objects. If not present, will auto-determine
           existence of these objects.
Tags
throws
Horde_Pack_Exception
Return values
string

The packed string.

unpack()

Unpack a string.

public unpack(string $data) : mixed
Parameters
$data : string

The packed string.

Tags
throws
Horde_Pack_Exception
Return values
mixed

The unpacked data.

Search results