tacoberu/php-naiacode

De/Serialization text with meta from/to human readable text string.

v1.0.2 2021-02-19 00:49 UTC

This package is auto-updated.

Last update: 2024-04-19 08:16:46 UTC


README

De/Serialization text with meta from/to human readable text string.

$str =
"Any-Header: with value
Meta: {"vendor":"zim","ver":"0.4"}
Content-Type: text/x-zim-wiki


And Lorem ipsum doler ist.";

(new Decoder())->decode($str) == [
    "And Lorem ipsum doler ist.",
    [
        'any-header' => "with value",
        'meta' => (object) [
            'vendor' => 'zim',
            'ver' => '0.4',
        ],
        'content-type' => "text/x-zim-wiki",
    ]
]

And encoding similarly.