Encoding processing library, providing encoding, decoding and other functions
Continuation library marshung/helper, only keep and maintain EncodeHelper
# composer require marsapp/encodehelper
Include composer autoloader before use.
require __PATH__ . "vendor/autoload.php";
Namespace use:
use marsapp\helper\encode\EncodeHelper;
Snapshot encode(zip)
snapshotEncode($data, $forceCompress = false) : String
Example :
$data = [
['c_sn' => 'a110', 'u_sn' => 'b1', 'u_no' => 'a001', 'u_name' => 'name1'],
];
$result = EncodeHelper::snapshotEncode($data);
$result:
// String
$result = '0[{"c_sn":"a110","u_sn":"b1","u_no":"a001","u_name":"name1"}]';
Snapshot decode(unzip)
snapshotDecode(String $data, $assoc = true) : mixed
Example :
$data = '0[{"c_sn":"a110","u_sn":"b1","u_no":"a001","u_name":"name1"}]';
$result = EncodeHelper::snapshotDecode($data);
$result:
$result = [
['c_sn' => 'a110', 'u_sn' => 'b1', 'u_no' => 'a001', 'u_name' => 'name1'],
];