PHPackages                             jensostertag/csvreader - 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. jensostertag/csvreader

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

jensostertag/csvreader
======================

CSV reader library for PHP

1.1.0(11mo ago)0959MITPHPPHP &gt;=8.0.0

Since Jun 7Pushed 11mo ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (3)Used By (0)

CSVReader for PHP
=================

[](#csvreader-for-php)

This is a PHP library to easily read CSV files.

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

[](#installation)

To install this library, include it in your project using composer:

```
composer require struktal/struktal-csv-reader
```

Usage
-----

[](#usage)

**Read all entries from a CSV file**To read all entries from a CSV file, use the following code:

```
$csvReader = new CSVReader();

// CSV Reader Options
$csvReader->setFile("path/to/file.csv")
          ->setHeader(false)
          ->setDelimiter(";")
          ->setMaxLineLength(null)
          ->read();

// Get the CSV Data
$data = $csvReader->getData();
```

You can use the `setHeader(bool $header)` method to specify whether the CSV file contains a header or not. If the method is called with `true` as parameter, the first row will be skipped and not returned in the `$data` array. By default, no header is assumed.

Instead of explicitly setting the delimiter, you can also use the `detectDelimiter()` method. This method uses the first line of the CSV file to detect which character of `,`, `;`, `\t` or `|` occurs most often and uses it as the delimiter.

> Warning: If the first line of the CSV file contains `,`, `;`, `\t` or `|` more often than the actual delimiter, the method will not detect the correct delimiter.

As an example, if the CSV file looks like this:

```
name;age;city
Alice;25;New York
Bob;30;London
Charlie;20;Berlin
David;35;Paris
Frank;40;Tokyo
```

the returned `$data` array would be:

```
[
    [
        "name",
        "age",
        "city"
    ],
    [
        "Alice",
        "25",
        "New York"
    ],
    [
        "Bob",
        "30",
        "London"
    ],
    [
        "Charlie",
        "20",
        "Berlin"
    ],
    [
        "David",
        "35",
        "Paris"
    ],
    [
        "Frank",
        "40",
        "Tokyo"
    ]
]
```

If you'd call the `setHeader(bool $header)` method with `true` as parameter, the contents of the first row will be omitted from the `$data` array:

```
[
    [
        "Alice",
        "25",
        "New York"
    ],
    [
        "Bob",
        "30",
        "London"
    ],
    [
        "Charlie",
        "20",
        "Berlin"
    ],
    [
        "David",
        "35",
        "Paris"
    ],
    [
        "Frank",
        "40",
        "Tokyo"
    ]
]
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance52

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Every ~9 days

Total

2

Last Release

336d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49905418?v=4)[Jens Ostertag](/maintainers/JensOstertag)[@JensOstertag](https://github.com/JensOstertag)

---

Top Contributors

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

---

Tags

csvfilesreader

### Embed Badge

![Health badge](/badges/jensostertag-csvreader/health.svg)

```
[![Health](https://phpackages.com/badges/jensostertag-csvreader/health.svg)](https://phpackages.com/packages/jensostertag-csvreader)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[league/csv

CSV data manipulation made easy in PHP

3.5k166.1M646](/packages/league-csv)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k24.9M47](/packages/rap2hpoutre-fast-excel)[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)[csanquer/colibri-csv

Lightweight and performant CSV reader and writer library

16161.7k4](/packages/csanquer-colibri-csv)

PHPackages © 2026

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