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

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

ork/csv
=======

A library to read and write CSV files.

2.3.0(6mo ago)0133MITPHP ^8.2

Since Apr 10Compare

[ Source](https://github.com/AlexHowansky/ork-csv)[ Packagist](https://packagist.org/packages/ork/csv)[ Docs](http://github.com/AlexHowansky/ork-csv)[ RSS](/packages/ork-csv/feed)WikiDiscussions Synced yesterday

READMEChangelogDependencies (8)Versions (20)Used By (0)

Ork CSV
=======

[](#ork-csv)

Ork CSV is a library for reading and writing CSV files.

[![Latest Version](https://camo.githubusercontent.com/74faa990ae3158a8276d0835290a70e2e10b85931708cde5b08bf8c3aa23262f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f726b2f637376)](https://packagist.org/packages/ork/csv)[![PHP](https://camo.githubusercontent.com/d16bfd908b409dca9d5923b1dc14a20d7cbb9c40e1b3661af10891804ffb20d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6f726b2f6373762f706870)](https://php.net)[![License](https://camo.githubusercontent.com/5d70fb8bf96d3a4df1665ee95196253ef39c34513fd0ffe5d7d9e10ae6f3d0e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f416c6578486f77616e736b792f6f726b2d637376)](https://github.com/AlexHowansky/ork-csv/blob/master/LICENSE)[![PHPStan](https://camo.githubusercontent.com/592ed17a59c334d1278ee4c67d9fc910cb2573a8c0a75664d81e14a4eeddcbbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d352d627269676874677265656e)](https://github.com/phpstan/phpstan)[![Test Status](https://camo.githubusercontent.com/dcae574ec8ca946c5d852eade12d9295364aca662396ad42fff88aac49569340/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416c6578486f77616e736b792f6f726b2d6373762f74657374732e796d6c)](https://github.com/AlexHowansky/ork-csv/actions/workflows/tests.yml)[![Code Coverage](https://camo.githubusercontent.com/efe220a52bdd36546dbb70757517e9f224ed75b2088bf3d0d6d910d54b69bf55/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f416c6578486f77616e736b792f6f726b2d637376)](https://app.codecov.io/gh/AlexHowansky/ork-csv)

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

[](#installation)

```
composer require ork/csv
```

### Reader

[](#reader)

Ork CSV provides a reader to parse delimited files into arrays. The reader is implemented as an iterator that yields the contents of one CSV line per iteration. If the file has a header line with column names, each yielded array will be associative, keyed by the names in the header. If the file does not have a header line with columns names, each yielded array will be indexed.

For example, a file with a header line:

```
ID,Name,Size
1,foo,large
2,bar,small
```

```
$csv = new \Ork\Csv\Reader('/path/to/file.csv');
foreach ($csv as $row) {
    print_r($row);
}
```

```
Array
(
    [ID] => 1
    [Name] => foo
    [Size] => large
)
Array
(
    [ID] => 2
    [Name] => bar
    [Size] => small
)

```

A file without a header line:

```
1,foo,large
2,bar,small
```

```
$csv = new \Ork\Csv\Reader(file: '/path/to/file.csv', hasHeader: false);
foreach ($csv as $row) {
    print_r($row);
}
```

```
Array
(
    [0] => 1
    [1] => foo
    [2] => large
)
Array
(
    [0] => 2
    [1] => bar
    [2] => small
)

```

### Writer

[](#writer)

Ork CSV provides a writer that will track columns and automatically generate an appropriate header line.

```
$csv = new \Ork\Csv\Writer('/path/to/file.csv');
$csv->write([
    'Id' => 1,
    'Name' => 'foo',
    'Size' => 'large',
]);
$csv->write([
    'Id' => 2,
    'Name' => 'bar',
    'Size' => 'small',
]);
```

```
Id,Name,Size
1,foo,large
2,bar,small
```

See the [docs](docs/Index.md) directory for full details.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance67

Regular maintenance activity

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

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

Recently: every ~281 days

Total

18

Last Release

193d ago

Major Versions

1.6.0 → 2.0.02023-10-09

PHP version history (8 changes)1.0.0PHP ^7.1

1.0.3PHP ^7.2

1.3.0PHP ^7.3

1.4.0PHP &gt;=7.3.0

1.5.0PHP &gt;=7.4.0

1.6.0PHP ^8.0

2.0.0PHP ^8.1

2.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c9c6c75df8002c9fb6580ead697962a2aed74757f49e0bcf10e505091121f08?d=identicon)[AlexHowansky](/maintainers/AlexHowansky)

---

Tags

csvork

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k152.8M851](/packages/maatwebsite-excel)[league/csv

CSV data manipulation made easy in PHP

3.5k176.5M798](/packages/league-csv)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k26.3M51](/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.2k65.5M210](/packages/openspout-openspout)[goodby/csv

CSV import/export library

9535.6M25](/packages/goodby-csv)[sonata-project/exporter

Lightweight Exporter library

44121.3M38](/packages/sonata-project-exporter)

PHPackages © 2026

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