PHPackages                             lantongxue/csv-reader - 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. lantongxue/csv-reader

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

lantongxue/csv-reader
=====================

A high-performance and low-memory CSV reader

00PHP

Since Mar 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/lantongxue/php-csv-reader)[ Packagist](https://packagist.org/packages/lantongxue/csv-reader)[ RSS](/packages/lantongxue-csv-reader/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CSVReader
=========

[](#csvreader)

A high-performance and low-memory CSV reader

Usage
=====

[](#usage)

install

```
composer require lantongxue/csv-reader
```

CSVReader constructor parameters：

```
CSVReader(string $csvFile, bool $firstRowIsHeader = true, array $getcsvParams = [])
```

`$csvFile` Specify CSV file path

`$firstRowIsHeader` Setting the first row as the header row, default `true`

`$getcsvParams` This parameter exists for compatibility with php8, but also improves the flexibility of csv reading, the specific parameter structure is as follows:

```
[
    'separator' => ",",
    'enclosure' => "\"",
    'escape' => "\\",
];
```

Refer to the fgetcsv function for the exact meaning.

Reading through an iterator
---------------------------

[](#reading-through-an-iterator)

```
$csv = 'test.csv';
$reader = new lantongxue\CSVReader($csv);
foreach($reader as $row) {
    // todo
}
```

Chunked read
------------

[](#chunked-read)

```
$csv = 'test.csv';
$reader = new lantongxue\CSVReader($csv);
$reader->Chunk(function($rows) {
    foreach($rows as $row) {
        // todo
    }
    return true;
}, 1000);
```

Other Api
=========

[](#other-api)

`GetHeader()` Return header row when the `$firstRowIsHeader` is `true`

License
=======

[](#license)

MIT

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

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://avatars.githubusercontent.com/u/20817666?v=4)[kali](/maintainers/lantongxue)[@lantongxue](https://github.com/lantongxue)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/lantongxue-csv-reader/health.svg)

```
[![Health](https://phpackages.com/badges/lantongxue-csv-reader/health.svg)](https://phpackages.com/packages/lantongxue-csv-reader)
```

###  Alternatives

[aune-io/magento2-product-category-url-fix

Product category url fix for Magento 2

165.9k](/packages/aune-io-magento2-product-category-url-fix)

PHPackages © 2026

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