{"id":23975666,"url":"https://github.com/salsify/jsonstreamingparser","last_synced_at":"2025-05-14T19:08:17.466Z","repository":{"id":6846900,"uuid":"8095519","full_name":"salsify/jsonstreamingparser","owner":"salsify","description":"A JSON streaming parser implementation in PHP.","archived":false,"fork":false,"pushed_at":"2023-07-11T12:20:03.000Z","size":231,"stargazers_count":755,"open_issues_count":8,"forks_count":132,"subscribers_count":59,"default_branch":"master","last_synced_at":"2025-04-18T21:26:29.213Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salsify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-02-08T15:13:19.000Z","updated_at":"2025-04-16T10:24:53.000Z","dependencies_parsed_at":"2024-06-18T11:17:59.998Z","dependency_job_id":null,"html_url":"https://github.com/salsify/jsonstreamingparser","commit_stats":{"total_commits":117,"total_committers":25,"mean_commits":4.68,"dds":0.7008547008547008,"last_synced_commit":"6f1a5d41490a53fd1942a95e2984132fb959308d"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fjsonstreamingparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fjsonstreamingparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fjsonstreamingparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fjsonstreamingparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salsify","download_url":"https://codeload.github.com/salsify/jsonstreamingparser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-07T06:26:13.129Z","updated_at":"2025-05-14T19:08:14.608Z","avatar_url":"https://github.com/salsify.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Streaming JSON parser for PHP\n=============================\n\n[![Build Status](https://travis-ci.org/salsify/jsonstreamingparser.png?branch=master)](https://travis-ci.org/salsify/jsonstreamingparser)\n[![GitHub tag](https://img.shields.io/github/tag/salsify/jsonstreamingparser.svg?label=latest)](https://packagist.org/packages/salsify/jsonstreamingparser) \n[![Packagist](https://img.shields.io/packagist/dt/salsify/json-streaming-parser.svg)](https://packagist.org/packages/salsify/json-streaming-parser)\n[![Coverage Status](https://coveralls.io/repos/salsify/jsonstreamingparser/badge.svg?branch=master)](https://coveralls.io/r/salsify/jsonstreamingparser?branch=master)\n[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://php.net/)\n[![License](https://img.shields.io/packagist/l/salsify/json-streaming-parser.svg)](https://packagist.org/packages/salsify/json-streaming-parser)\n\nThis is a simple, streaming parser for processing large JSON documents.\nUse it for parsing very large JSON documents to avoid loading the entire thing into memory, which is how just about\nevery other JSON parser for PHP works.\n\nFor 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)\nthat talks about pros and cons vs. the standard PHP JSON parser.\n\nIf you've ever used a [SAX parser](http://en.wikipedia.org/wiki/Simple_API_for_XML) for XML (or even JSON) in another\nlanguage, that's what this is. Except for JSON in PHP.\n\nThis package is compliant with [PSR-4](https://www.php-fig.org/psr/psr-4/), [PSR-1](https://www.php-fig.org/psr/psr-1/), and\n[PSR-2](https://www.php-fig.org/psr/psr-2/).\nIf you notice compliance oversights, please send a patch via pull request.\n\nInstallation\n-----\n\nTo install `JsonStreamingParser` you can either clone this repository or you can use composer\n\n```bash\ncomposer require salsify/json-streaming-parser\n```\n\nUsage\n-----\n\nTo use the `JsonStreamingParser` you just have to implement the `\\JsonStreamingParser\\Listener` interface.\nYou then pass your `Listener` into the parser.\n\nFor example:\n\n```php\n$stream = fopen('doc.json', 'r');\n$listener = new YourListener();\ntry {\n  $parser = new \\JsonStreamingParser\\Parser($stream, $listener);\n  $parser-\u003eparse();\n  fclose($stream);\n} catch (Exception $e) {\n  fclose($stream);\n  throw $e;\n}\n```\n\nThat's it! Your `Listener` will receive events from the streaming parser as it works.\n\nThere is a complete example of this in `example/example.php`.\n\nRunning tests\n-----\n```bash\nmake test\n```\n\nProjects using this library\n---------------------------\n\n[JSON Collection Parser](https://github.com/MAXakaWIZARD/JsonCollectionParser)\n\n[JSON Objects](https://github.com/cerbero90/json-objects)\n\n\nLicense\n-------\n\n[MIT License](http://mit-license.org/) (c) Salsify, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalsify%2Fjsonstreamingparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalsify%2Fjsonstreamingparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalsify%2Fjsonstreamingparser/lists"}