Package
, (*1)
JSON Text Sequences (RFC7464) encoder and decoder for PHP, (*2)
JSON Text Sequences define a streamable JSON encoding and parsing based on a delimiter for multiple JSON encoded texts., (*3)
See https://tools.ietf.org/html/rfc7464 for the JSON Text Sequences RFC., (*4)
Install
Via Composer, (*5)
``` bash
$ composer require networkteam/json-seq, (*6)
## Usage
Encoding data in JSON Text Sequences:
``` php
$stringWriter = new StringWriter();
$encoder = new Encoder($stringWriter);
$encoder->emit(['id' => '1', ...]);
$encoder->emit(['id' => '2', ...]);
$result = $stringWriter->getString();
Decoding JSON Text Sequences from a string:, (*7)
``` php
$jsonTexts = "\x1E{...}\x0A\x1E{...}\x0A";, (*8)
$decoder = new StringDecoder();
foreach ($decoder->decode($jsonTexts) as $data) {
// process $data
}, (*9)
## Testing
``` bash
$ composer test
License
The MIT License (MIT). Please see License File for more information., (*10)