the PHP kernel changes frequently which lead that the serialize module is too expensive to maintain, so temporarily give up support for more than PHP7.3.
- PHP 7+
pecl install swoole_serialize
or
phpize
./configure
make
make install
echo "extension=/path/to/swoole_serialize.so" >> php.ini
- the fastest serialize function for php7 (see bench.php,or you can bench it use you data,trust me it is cool!).
- support pack and fastPack two function.
- support __sleep __wakeup __autoload etc.
$str = swoole_pack($arr);
$arr = swoole_unpack($str);
$str = swoole_fast_pack($arr);
$arr = swoole_unpack($str);
or
$str = swSerialize::pack($arr);
$arr = swSerialize::unpack($str);
$str = swSerialize::fastPack($arr);
$arr = swSerialize::unpack($str);
or
$o = new swSerialize();
$str = $o->pack($arr);
$o->unpack($str);
$o = new swSerialize();
$str = $o->fastPack($arr);
$o->unpack($str);
Apache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html