PHPackages                             taranto/csv-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. taranto/csv-parser

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

taranto/csv-parser
==================

CSV parser for PHP7.0 or later

v1.0.0(9y ago)023[1 issues](https://github.com/renan-taranto/csv-parser/issues)MITPHPPHP &gt;=7.0CI failing

Since Jan 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/renan-taranto/csv-parser)[ Packagist](https://packagist.org/packages/taranto/csv-parser)[ RSS](/packages/taranto-csv-parser/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/06ef847993d56b05b0ca0d455d294873b78036bcd33f7066a8f8a5dd7dfbdb4f/68747470733a2f2f7472617669732d63692e6f72672f72656e616e2d746172616e746f2f6373762d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/renan-taranto/csv-parser)[![Coverage Status](https://camo.githubusercontent.com/06ae6638859505e7093d22c9f520c939315746cbcd1c847ecaf443472e4e4f29/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f72656e616e2d746172616e746f2f6373762d7061727365722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/renan-taranto/csv-parser?branch=master)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

CSV Parser
==========

[](#csv-parser)

An easy to use CSV parser

### Features

[](#features)

- Converts CSV to arrays and arrays indexed by the first row cells (headers);
- Automatically guesses CSV fields delimiter;
- Provides limit and offset options for parsing;
- Performance wise parsing while using as an iterator.

### Requirements

[](#requirements)

- PHP 7.0 or later.

### Installation

[](#installation)

```
composer require taranto/csv-parser

```

### Usage

[](#usage)

Parsing a CSV file to an array:

```
$csvParser = new CsvParser('file.csv');
$csvAsArray = $csvParser->getCsvAsArray();
```

Parsing a CSV file to an array indexed by the first row cells (headers):

```
$csvParser = new CsvParser('file.csv');
$csvAsArray = $csvParser->getCsvAsAssociativeArray();
```

Performance wise usage (good for large files):

- Simple arrays

```
$csvParser = new CsvParser('file.csv');
$csvAsArray = [];
foreach ($csvParser as $row) {
    $csvAsArray[] = $row;
}
```

- Associative arrays

```
$csvParser = new CsvParser('file.csv', true);
$csvAsArray = [];
foreach ($csvParser as $row) {
    $csvAsArray[] = $row;
}
```

### Example

[](#example)

Given the CSV

```
| name  | birthdate   |
| John  |  1985-02-03 |
|  Kim  |  1976-05-04 |
|  Suzy |  1991-04-02 |
|  Tom  |  1970-01-03 |

```

Parsing to an associtive array with offset(1) and limit(2):

```
$csvParser = new CsvParser('file.csv');
$csvAsArray = $csvParser->getCsvAsAssociativeArray(1, 2);
```

Returns:

```
[
    ["name" => "Kim", "birthdate" => "1976-05-04"]
    ["name" => "Suzy", "birthdate" => "1991-04-02"]
]
```

### Author

[](#author)

- **Renan Taranto** - **

### License

[](#license)

This project is licensed under the MIT License - see the LICENSE.txt file for details

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3395d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e94e951d98af26f49610649907669b2361bf6f71dc132cfc908318133161f160?d=identicon)[renan-taranto](/maintainers/renan-taranto)

---

Top Contributors

[![renan-taranto](https://avatars.githubusercontent.com/u/10513720?v=4)](https://github.com/renan-taranto "renan-taranto (21 commits)")

---

Tags

parsercsvread

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/taranto-csv-parser/health.svg)

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

###  Alternatives

[league/csv

CSV data manipulation made easy in PHP

3.5k166.1M646](/packages/league-csv)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M131](/packages/openspout-openspout)[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)[rodenastyle/stream-parser

PHP Multiformat Streaming Parser

443195.7k2](/packages/rodenastyle-stream-parser)[shuchkin/simplecsv

Parse and retrieve data from CSV files. Export data to CSV.

5192.4k](/packages/shuchkin-simplecsv)[dcat/easy-excel

使用简单实用的语义化接口快速读写Excel文件

155373.4k24](/packages/dcat-easy-excel)

PHPackages © 2026

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