janeklb / json-char-input-reader
Read a JSON stream and execute callbacks whenever complete JSON chunks are parsed
Installs: 44 439
Dependents: 0
Suggesters: 0
Security: 0
Stars: 24
Watchers: 2
Forks: 5
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: 3.7.18
This package is not auto-updated.
Last update: 2024-12-18 12:33:39 UTC
README
This is a stream reader used to process JSON data character-by-character and execute callbacks after parsing complete chunks.
The data stream must be in the form of a JSON array.
ie. [1, 2, [3, 4], {"five": "six"}, ...
Example
To get a feel for it, run the following in your terminal:
$ cat | php example/example.php
[Terminate with CTRL^D or CTRL^C]
Testing
Install composer with dev dependencies composer install --dev
and run
$ ./vendor/bin/phpunit test/
Todo
- fire callbacks on deeper nested values, rather than "top level" entries in the stream array
License
Distributed under the MIT Licence