Skip to content

devmatrash/huge-json-collection-streaming-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huge JSON collection streaming parser for PHP

Build Status GitHub tag Packagist Minimum PHP Version License

This package is streaming parser for processing huge JSON documents. Can load the objects of JSON documents which is an array of objects one by one. The structure of JSON documents needs to be the following structure.

e.g.)

[
  {
    "id": 1,
    "name": "foo",

    ...

  },
  {
    "id": 2,
    "name": "bar",

    ...

  },

  ...

]

This package is compliant with PSR-4, PSR-1, and PSR-2. If you notice compliance oversights, please send a patch via pull request.

Installation

To install HugeJsonCollectionStreamingParser you can either clone this repository or you can use composer.

composer require suemitsu/huge-json-collection-streaming-parser

Usage

$filePath = 'path/to/huge-json-file.json';

$parser = new \HugeJsonCollectionStreamingParser\Parser($filePath);

while ($parser->next()) {
    $item = $parser->current();

    // do anything...
}

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

License

MIT License

About

Huge JSON collection streaming parser for PHP

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%