PHPackages                             jotaelesalinas/php-data-streams - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jotaelesalinas/php-data-streams

Active[Utility &amp; Helpers](/categories/utility)

jotaelesalinas/php-data-streams
===============================

00PHPCI failing

Pushed today1 watchersCompare

[ Source](https://github.com/jotaelesalinas/php-data-streams)[ Packagist](https://packagist.org/packages/jotaelesalinas/php-data-streams)[ RSS](/packages/jotaelesalinas-php-data-streams/feed)WikiDiscussions master Synced today

READMEChangelog (10)DependenciesVersionsUsed By (0)

php-data-streams
================

[](#php-data-streams)

\[!IMPORTANT\] This is a breaking v2 release and is not compatible with the old `jotaelesalinas/php-rwgen` package. The package name, namespace, and public API have changed.

[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)[![CI](https://camo.githubusercontent.com/922acc12b8a00c48199fc3a29dd49242785675ac39c22b6fffd623a4e6ee8a49/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6f7461656c6573616c696e61732f7068702d646174612d73747265616d732f63692e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/jotaelesalinas/php-data-streams/actions/workflows/ci.yml)

`php-data-streams` is a PHP streaming library for reading and writing large CSV, JSON, XML, XLSX, KML, HTTP and database-backed records without loading everything into memory.

It is designed for data pipelines, import/export jobs, CLI tools and integrations where you want small, explicit reader and writer abstractions instead of heavyweight framework-specific layers.

What it solves
--------------

[](#what-it-solves)

- Process large files and responses record by record.
- Keep memory usage predictable while iterating through data.
- Compose simple readers and writers around generators and iterables.
- Reuse a shared contract across multiple formats.

How This Repository Is Organized
--------------------------------

[](#how-this-repository-is-organized)

This project is a monorepo split into several smaller packages.

That means the repository contains multiple packages in one place, but you do not need to install all of them. Install only the package or packages you actually need.

For example:

- If you only work with CSV files, install the CSV package.
- If you only need JSON Lines, install the JSON package.
- If you want the shared reader and writer interfaces for your own code, install the core package.

Packages
--------

[](#packages)

- [`core`](packages/core/README.md) for the shared `Reader` and `Writer` contracts.
- [`csv`](packages/csv/README.md) for CSV and TSV readers and writers.
- [`json`](packages/json/README.md) for JSON, JSON arrays and NDJSON / JSON Lines.
- [`xml`](packages/xml/README.md) for lazy XML readers and streaming XML writers.
- [`kml`](packages/kml/README.md) for KML output built on XML.
- [`pdo`](packages/pdo/README.md) for database cursor helpers.
- [`http`](packages/http/README.md) for line and page-oriented HTTP streams.
- [`excel`](packages/excel/README.md) for minimal XLSX sheet readers.

Quick Example
-------------

[](#quick-example)

```
use JLSalinas\DataStreams\Csv\CsvReader;

$reader = new CsvReader(__DIR__ . '/customers.csv');

foreach ($reader as $customer) {
    echo $customer['name'] . PHP_EOL;
}
```

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

[](#installation)

Install the package you need via Composer. For example, to work with CSV files:

```
composer require jotaelesalinas/php-data-streams-csv
```

If you want to work with JSON Lines:

```
composer require jotaelesalinas/php-data-streams-json
```

If you want to build your own reader or writer and only need the shared interfaces:

```
composer require jotaelesalinas/php-data-streams-core
```

You can also install more than one package if your project needs them.

Example Usage
-------------

[](#example-usage)

### CSV reader

[](#csv-reader)

```
use JLSalinas\DataStreams\Csv\CsvReader;

$reader = new CsvReader(__DIR__ . '/customers.csv');

foreach ($reader as $customer) {
    echo $customer['name'] . PHP_EOL;
}
```

### CSV writer

[](#csv-writer)

```
use JLSalinas\DataStreams\Csv\CsvWriter;

$writer = new CsvWriter(__DIR__ . '/export.csv');
$writer->write(['name' => 'Ada', 'email' => 'ada@example.com']);
$writer->write(['name' => 'Grace', 'email' => 'grace@example.com']);
$writer->close();
```

### JSON reader

[](#json-reader)

```
use JLSalinas\DataStreams\Json\JsonReader;

$reader = new JsonReader(__DIR__ . '/events.ndjson');

foreach ($reader as $event) {
    var_dump($event);
}
```

Typical Use Cases
-----------------

[](#typical-use-cases)

- CSV/TSV imports and exports.
- JSON Lines ingestion and generation.
- XML feeds and document-to-record transforms.
- XLSX sheet reading in long-running jobs.
- KML generation from geospatial records.
- Streaming database results and HTTP responses.

Project Status
--------------

[](#project-status)

This repository is the home of independently publishable packages. The codebase has been renamed and reorganized around the `JLSalinas\DataStreams` namespace, and each package README documents its own behavior and usage.

###  Health Score

20

↑

LowBetter than 13% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity8

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/94935088e6eab9c315a8a07d49152d0bd4aaab1fb468d6c481408e10c95babc8?d=identicon)[jotaelesalinas](/maintainers/jotaelesalinas)

---

Top Contributors

[![jotaelesalinas](https://avatars.githubusercontent.com/u/2042875?v=4)](https://github.com/jotaelesalinas "jotaelesalinas (52 commits)")

---

Tags

foreachgeneratorsinput-outputiophpreaderswriters

### Embed Badge

![Health badge](/badges/jotaelesalinas-php-data-streams/health.svg)

```
[![Health](https://phpackages.com/badges/jotaelesalinas-php-data-streams/health.svg)](https://phpackages.com/packages/jotaelesalinas-php-data-streams)
```

###  Alternatives

[a21ns1g4ts/filament-short-url

This is my package filament-short-url

274.0k](/packages/a21ns1g4ts-filament-short-url)

PHPackages © 2026

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