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

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

webgriffe/amp-csv
=================

CSV library to use with Amp PHP framework.

v0.3.0(1y ago)23.6k1[1 issues](https://github.com/webgriffe/amp-csv/issues)MITPHPPHP &gt;=8CI failing

Since Mar 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/webgriffe/amp-csv)[ Packagist](https://packagist.org/packages/webgriffe/amp-csv)[ RSS](/packages/webgriffe-amp-csv/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (5)Versions (10)Used By (0)

AMP Comma Separated Values Library
==================================

[](#amp-comma-separated-values-library)

[![Build Status](https://camo.githubusercontent.com/c498a946c7e8b64c32855d26df0eedeae469146ebdde317cadf10557a9c808dd/68747470733a2f2f7472617669732d63692e6f72672f7765626772696666652f616d702d6373762e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webgriffe/amp-csv)

CSV library to use with [Amp](https://amphp.org/) PHP framework. Currently it implements only an iterator which allows to parse CSV rows one at a time.

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

[](#installation)

Require this package using [Composer](https://getcomposer.org/):

```
composer require webgriffe/amp-csv

```

Iterator Usage
--------------

[](#iterator-usage)

This library implements an Amp's [Iterator](https://amphp.org/amp/iterators/) which allows to iterate over CSV rows one at a time. Potentially it can parse very large CSV files because only small chunks are kept in memory. See the following example, given this CSV file (`path/to/file.csv`):

```
Name,Description,Price,Stock
RaspberryPi,"Raspberry PI Modell B, 512 MB",37.05,12
SanDisk Ultra SDHC,SanDisk Ultra SDHC 8 GB 30 MB/s Classe 10,6.92,54
```

We can have:

```
