PHPackages                             p1ratrulezzz/json-streaming-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. p1ratrulezzz/json-streaming-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

p1ratrulezzz/json-streaming-parser
==================================

A streaming parser for JSON in PHP.

v8.0.1(7y ago)03.0k1MITPHPPHP ^7.1

Since Oct 31Pushed 6y ago1 watchersCompare

[ Source](https://github.com/p1ratrulezzz/jsonstreamingparser)[ Packagist](https://packagist.org/packages/p1ratrulezzz/json-streaming-parser)[ Docs](https://github.com/salsify/jsonstreamingparser)[ RSS](/packages/p1ratrulezzz-json-streaming-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (19)Used By (1)

Streaming JSON parser for PHP
=============================

[](#streaming-json-parser-for-php)

[![Build Status](https://camo.githubusercontent.com/9dfa36f88f66fd046d7359e5e7fb3dbcdaf23263001789e1ede3ede9686c8c18/68747470733a2f2f7472617669732d63692e6f72672f73616c736966792f6a736f6e73747265616d696e677061727365722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/salsify/jsonstreamingparser)[![GitHub tag](https://camo.githubusercontent.com/520380f7718c9498b0a42e1b629edc9a85a3ed8ba818f4ee760b2eb21a13a3f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f73616c736966792f6a736f6e73747265616d696e677061727365722e7376673f6c6162656c3d6c6174657374)](https://packagist.org/packages/salsify/jsonstreamingparser)[![Packagist](https://camo.githubusercontent.com/8984d20c58d8a0a0ad6ea6335ba4e44a2aab52cafbe3cd807d956367f6e48b22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616c736966792f6a736f6e2d73747265616d696e672d7061727365722e737667)](https://packagist.org/packages/salsify/json-streaming-parser)[![Minimum PHP Version](https://camo.githubusercontent.com/be3b30c4ceb47b639794ebe0895f4fec6871dd53b2d7ae58d654a2018c3844fb/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/3656c907dfc76a9d532832ab6fb42814cc8b6863fc4982f63b705c4b1783f2eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73616c736966792f6a736f6e2d73747265616d696e672d7061727365722e737667)](https://packagist.org/packages/salsify/json-streaming-parser)

This is a simple, streaming parser for processing large JSON documents. Use it for parsing very large JSON documents to avoid loading the entire thing into memory, which is how just about every other JSON parser for PHP works.

For more details, I've written up a longer explanation of the [JSON streaming parser](http://www.salsify.com/blog/json-streaming-parser-for-php/1056)that talks about pros and cons vs. the standard PHP JSON parser.

If you've ever used a [SAX parser](http://en.wikipedia.org/wiki/Simple_API_for_XML) for XML (or even JSON) in another language, that's what this is. Except for JSON in PHP.

This package is compliant with [PSR-4](http://www.php-fig.org/psr/4/), [PSR-1](http://www.php-fig.org/psr/1/), and [PSR-2](http://www.php-fig.org/psr/2/). If you notice compliance oversights, please send a patch via pull request.

Installation
------------

[](#installation)

To install `JsonStreamingParser` you can either clone this repository or you can use composer

```
composer require salsify/json-streaming-parser

```

Usage
-----

[](#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 \JsonStreamingParser\Parser($stream, $listener);
  $parser->parse();
  fclose($stream);
} catch (Exception $e) {
  fclose($stream);
  throw $e;
}
```

That's it! Your `Listener` will receive events from the streaming parser as it works.

There is a complete example of this in `example/example.php`.

Projects using this library
---------------------------

[](#projects-using-this-library)

[JSON Collection Parser](https://github.com/MAXakaWIZARD/JsonCollectionParser)

[JSON Objects](https://github.com/cerbero90/json-objects)

License
-------

[](#license)

[MIT License](http://mit-license.org/) (c) Salsify, Inc.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~136 days

Recently: every ~55 days

Total

16

Last Release

2532d ago

Major Versions

v3.0 → v4.02015-03-07

v4.0 → v5.02015-11-01

v5.1.0 → v6.02016-03-20

v6.0.3 → v7.02018-03-29

v7.0 → v8.02018-10-26

PHP version history (3 changes)v1.0PHP &gt;=5.3

v6.0PHP ^5.4 | ^7.0

v8.0PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/fdee86c889de97363d62013d855a7ec155f0660fb729bd34400dc3f6c7cc14e4?d=identicon)[p1ratrulezzz](/maintainers/p1ratrulezzz)

---

Top Contributors

[![gonzofy](https://avatars.githubusercontent.com/u/52811?v=4)](https://github.com/gonzofy "gonzofy (53 commits)")[![MAXakaWIZARD](https://avatars.githubusercontent.com/u/1138453?v=4)](https://github.com/MAXakaWIZARD "MAXakaWIZARD (21 commits)")[![Magomogo](https://avatars.githubusercontent.com/u/728657?v=4)](https://github.com/Magomogo "Magomogo (19 commits)")[![dfreeman](https://avatars.githubusercontent.com/u/108688?v=4)](https://github.com/dfreeman "dfreeman (5 commits)")[![Wohlie](https://avatars.githubusercontent.com/u/329240?v=4)](https://github.com/Wohlie "Wohlie (4 commits)")[![phaza](https://avatars.githubusercontent.com/u/4553?v=4)](https://github.com/phaza "phaza (3 commits)")[![mdibbets](https://avatars.githubusercontent.com/u/1777212?v=4)](https://github.com/mdibbets "mdibbets (3 commits)")[![OnkelTem](https://avatars.githubusercontent.com/u/114060?v=4)](https://github.com/OnkelTem "OnkelTem (2 commits)")[![p1ratrulezzz](https://avatars.githubusercontent.com/u/5019669?v=4)](https://github.com/p1ratrulezzz "p1ratrulezzz (1 commits)")[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (1 commits)")[![vearutop](https://avatars.githubusercontent.com/u/1381436?v=4)](https://github.com/vearutop "vearutop (1 commits)")[![krchiper](https://avatars.githubusercontent.com/u/23555549?v=4)](https://github.com/krchiper "krchiper (1 commits)")[![dennishuckabee](https://avatars.githubusercontent.com/u/9324267?v=4)](https://github.com/dennishuckabee "dennishuckabee (1 commits)")[![evulse](https://avatars.githubusercontent.com/u/1631174?v=4)](https://github.com/evulse "evulse (1 commits)")[![jchamberlain](https://avatars.githubusercontent.com/u/3923548?v=4)](https://github.com/jchamberlain "jchamberlain (1 commits)")[![jorissteyn](https://avatars.githubusercontent.com/u/448056?v=4)](https://github.com/jorissteyn "jorissteyn (1 commits)")[![jredburn](https://avatars.githubusercontent.com/u/884775?v=4)](https://github.com/jredburn "jredburn (1 commits)")[![Kolyunya](https://avatars.githubusercontent.com/u/2682768?v=4)](https://github.com/Kolyunya "Kolyunya (1 commits)")[![ArtemProf](https://avatars.githubusercontent.com/u/23234815?v=4)](https://github.com/ArtemProf "ArtemProf (1 commits)")

---

Tags

jsonparserstreaming

### Embed Badge

![Health badge](/badges/p1ratrulezzz-json-streaming-parser/health.svg)

```
[![Health](https://phpackages.com/badges/p1ratrulezzz-json-streaming-parser/health.svg)](https://phpackages.com/packages/p1ratrulezzz-json-streaming-parser)
```

###  Alternatives

[salsify/json-streaming-parser

A streaming parser for JSON in PHP.

7766.7M14](/packages/salsify-json-streaming-parser)[clue/ndjson-react

Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.

15267.7M16](/packages/clue-ndjson-react)[pcrov/jsonreader

JSON Pull Parser

1451.2M5](/packages/pcrov-jsonreader)[bcncommerce/json-stream

A bundle of tools to work with JSON in PHP

642.2M3](/packages/bcncommerce-json-stream)[cerbero/json-parser

Zero-dependencies pull parser to read large JSON from any source in a memory-efficient way.

803474.6k5](/packages/cerbero-json-parser)[laktak/hjson

JSON for Humans. A configuration file format with relaxed syntax, fewer mistakes and more comments.

86233.7k12](/packages/laktak-hjson)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
