PHPackages                             denis-kisel/stream-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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. denis-kisel/stream-parser

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

denis-kisel/stream-parser
=========================

PHP Multiformat Streaming Parser

1.3.1(5y ago)01MITPHPPHP ^7.1.3

Since May 15Pushed 5y agoCompare

[ Source](https://github.com/denis-kisel/stream-parser)[ Packagist](https://packagist.org/packages/denis-kisel/stream-parser)[ Patreon](https://www.patreon.com/sergiorodenas)[ RSS](/packages/denis-kisel-stream-parser/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (4)Versions (12)Used By (0)

⚡ PHP7 / Laravel Multi-format Streaming Parser
==============================================

[](#-php7--laravel-multi-format-streaming-parser)

> When it comes to parsing XML/CSV/JSON/... documents, there are 2 approaches to consider:
>
> **DOM loading**: loads all the document, making it easy to navigate and parse, and as such provides maximum flexibility for developers.
>
> **Streaming**: implies iterating through the document, acts like a cursor and stops at each element in its way, thus avoiding memory overkill.

Thus, when it comes to big files, callbacks will be executed meanwhile file is downloading and will be much more efficient as far as memory is concerned.

Forked from [rodenastyle](https://github.com/sergiorodenas/stream-parser)

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

[](#installation)

```
composer require denis-kisel/stream-parser

```

Recommended usage
-----------------

[](#recommended-usage)

Delegate as possible the callback execution so it doesn't blocks the document reading:

(Laravel Queue based example)

```
use Tightenco\Collect\Support\Collection;

StreamParser::xml("https://example.com/users.xml")->each(function(Collection $user){
    dispatch(new App\Jobs\SendEmail($user));
});
```

Practical Input/Code/Output demos
---------------------------------

[](#practical-inputcodeoutput-demos)

### XML

[](#xml)

```

        The Iliad and The Odyssey
        12.95

                Best translation I've read.

                I like other versions better.

    [...]

```

```
use Tightenco\Collect\Support\Collection;

StreamParser::xml("https://example.com/books.xml")->each(function(Collection $book){
    var_dump($book);
    var_dump($book->get('comments')->toArray());
});
```

```
class Tightenco\Collect\Support\Collection#19 (1) {
  protected $items =>
  array(4) {
    'ISBN' =>
    string(13) "10-000000-001"
    'title' =>
    string(25) "The Iliad and The Odyssey"
    'price' =>
    string(5) "12.95"
    'comments' =>
    class Tightenco\Collect\Support\Collection#17 (1) {
      protected $items =>
      array(2) {
        ...
      }
    }
  }
}
array(2) {
  [0] =>
  array(2) {
    'rating' =>
    string(1) "4"
    'userComment' =>
    string(27) "Best translation I've read."
  }
  [1] =>
  array(2) {
    'rating' =>
    string(1) "2"
    'userComment' =>
    string(29) "I like other versions better."
  }
}

```

### JSON

[](#json)

```
[
  {
    "title": "The Iliad and The Odyssey",
    "price": 12.95,
    "comments": [
      {"comment": "Best translation I've read."},
      {"comment": "I like other versions better."}
    ]
  },
  {
    "title": "Anthology of World Literature",
    "price": 24.95,
    "comments": [
      {"comment": "Needs more modern literature."},
      {"comment": "Excellent overview of world literature."}
    ]
  }
]
```

```
use Tightenco\Collect\Support\Collection;

StreamParser::json("https://example.com/books.json")->each(function(Collection $book){
    var_dump($book->get('comments')->count());
});
```

```
int(2)
int(2)

```

### CSV

[](#csv)

```
title,price,comments
The Iliad and The Odyssey,12.95,"Best translation I've read.,I like other versions better."
Anthology of World Literature,24.95,"Needs more modern literature.,Excellent overview of world literature."
```

```
use Tightenco\Collect\Support\Collection;

StreamParser::csv("https://example.com/books.csv")->each(function(Collection $book){
    var_dump($book->get('comments')->last());
});
```

```
string(29) "I like other versions better."
string(39) "Excellent overview of world literature."

```

License
-------

[](#license)

This library is released under [MIT](http://www.tldrlegal.com/license/mit-license) license.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 72.1% of commits — single point of failure

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 ~92 days

Recently: every ~212 days

Total

11

Last Release

1998d ago

Major Versions

1.0.5 → 2.0.x-dev2018-07-29

PHP version history (2 changes)1.0.0PHP ^7.0

v1.2PHP ^7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/76b9b00b6d5b5f8de8f20a5e39e9e4a6caef51a637ad8a047787a6442b9278ef?d=identicon)[denis-kisel](/maintainers/denis-kisel)

---

Top Contributors

[![sergiorodenas](https://avatars.githubusercontent.com/u/2689890?v=4)](https://github.com/sergiorodenas "sergiorodenas (31 commits)")[![jn-jairo](https://avatars.githubusercontent.com/u/5104869?v=4)](https://github.com/jn-jairo "jn-jairo (4 commits)")[![den-is-ua](https://avatars.githubusercontent.com/u/235117855?v=4)](https://github.com/den-is-ua "den-is-ua (4 commits)")[![tachigami](https://avatars.githubusercontent.com/u/4858247?v=4)](https://github.com/tachigami "tachigami (1 commits)")[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (1 commits)")[![james-simmonds](https://avatars.githubusercontent.com/u/1891906?v=4)](https://github.com/james-simmonds "james-simmonds (1 commits)")[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (1 commits)")

---

Tags

streamjsonlaravelxmlparsercsvpullPHP7

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/denis-kisel-stream-parser/health.svg)

```
[![Health](https://phpackages.com/badges/denis-kisel-stream-parser/health.svg)](https://phpackages.com/packages/denis-kisel-stream-parser)
```

###  Alternatives

[rodenastyle/stream-parser

PHP Multiformat Streaming Parser

443195.7k2](/packages/rodenastyle-stream-parser)[mledoze/countries

List of world countries in JSON, CSV, XML and YAML

6.2k699.7k6](/packages/mledoze-countries)[faisalman/simple-excel-php

Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats

582599.4k1](/packages/faisalman-simple-excel-php)[ee/dataexporter-bundle

Easy export data to CSV, XML, HTML, JSON or XLS

4982.5k](/packages/ee-dataexporter-bundle)[dracoblue/craur

A lossless xml to json and json to xml converter (and csv/xlsx/yaml). Writing PHP Json/Xml/Csv/Yaml/excel Importers made easy

4643.1k2](/packages/dracoblue-craur)[initred/laravel-tabula

laravel-tabula is a tool for liberating data tables trapped inside PDF files for the Laravel framework.

1418.6k](/packages/initred-laravel-tabula)

PHPackages © 2026

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