im0rtality/jsonstreamingparser
最新稳定版本:v4.0.0
Composer 安装命令:
composer require im0rtality/jsonstreamingparser
包简介
A streaming parser for JSON in PHP.
关键字:
README 文档
README
Not invented here
Code forked from https://github.com/salsify/jsonstreamingparser and some fixed added:
- Removed file_position callback from listener (we did not need it and it gave significant performance boost)
- PSR2
Features
- Stream based - low memory footprint does not grow with file size
- Similar to SAX parser
Known drawbacks
- Performance is not as good as it should be (throughput - ~1MB per 9 secs, VirtualBox, Debian 7 on 4.3GHz CPU, single core)
Usage
To use the JsonStreamingParser you just have to implement the JsonStreamingParser\Listener interface. You then pass your Listener into the parser. For example:
$stream = fopen('doc.json', 'r'); $listener = new YourListener(); try { $parser = new Parser($stream, $listener); $parser->parse(); } catch (Exception $e) { fclose($stream); throw $e; }
That's it! Your Listener will receive events from the streaming parser as it works.
License
MIT License
统计信息
- 总下载量: 33.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-07-04