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

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

graze/csv-token
===============

Tokenised Csv Reader

0.3.1(9y ago)02611MITPHPPHP &gt;=5.6.0

Since May 17Pushed 9y ago10 watchersCompare

[ Source](https://github.com/graze/csv-token)[ Packagist](https://packagist.org/packages/graze/csv-token)[ Docs](https://github.com/graze/csv-token)[ RSS](/packages/graze-csv-token/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (6)Dependencies (5)Versions (7)Used By (0)

csv-token
=========

[](#csv-token)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6592b0fe231ba45201e1057ffbb3d03befc667783e8b571de3a489246e11e653/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6772617a652f6373762d746f6b656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graze/csv-token)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/7b2bf12c23ef94b71c995274ae722fc455d1bc2abd26884bbcbce3dc7e27729d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6772617a652f6373762d746f6b656e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/graze/csv-token)[![Coverage Status](https://camo.githubusercontent.com/d1c29c06f799c141861ff50acf40b07fcff18df79f7174291ee775c9dee9155e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6772617a652f6373762d746f6b656e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graze/csv-token/code-structure)[![Quality Score](https://camo.githubusercontent.com/78b22d99a2500641a2dc6b8046a9a0ac83b8cff99ed43b947fd1a11cf072ce8d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6772617a652f6373762d746f6b656e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graze/csv-token)[![Total Downloads](https://camo.githubusercontent.com/234f6d38b80f986c75f728d9d98216a7acc63b4b6562e870e098bddaa86cf3c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6772617a652f6373762d746f6b656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graze/csv-token)

Tokenised Csv Reader that handles some of the strange configurations databases and application use.

- Parses tokens and csv from streams and outputs using a Lazy Iterator

Csv FeatureExampleArrayDelimiter`thingother`Quote Enclosure`"quote, here",not here``['quote, here', 'not here']`Escaping`"\"text","new\\nline"``['"text',"new\\\nline"]`Double Quotes`"""text","more"``['"text','more']`Double Quotes and Escaping`"""text","\, text"``['"text',', text']`Null value parsing`"text",\\N,"text"``['text',null,'text']`Boolean value parsing`"text",false,true``['text',false,true]`Numeric value parsing`"text",1,-2.3,3.1e-24``['text',1,-2.3,3.1e-24]`Handling of Byte Order Marks`"text","things"``['text','things']`Install
-------

[](#install)

Via Composer

```
$ composer require graze/csv-token
```

Usage
-----

[](#usage)

#### Simple reader

[](#simple-reader)

```
$csvDefinition = new CsvDefinition();
$reader = new Reader($csvDefinition, $stream);
$iterator = $reader->read();
```

#### More advanced parsing (with value parsers)

[](#more-advanced-parsing-with-value-parsers)

```
// $stream = '"some","text",true,false,0,1,2';
$csvDefiniton = new CsvDefinition();
$parser = new Parser([new BoolValueParser(), new NumberValueParser()]);
$tokeniser = new StreamTokeniser($csvDefinition, $stream);
$iterator = $parser->parser($tokeniser->getTokens());

var_dump(iterator_to_array($iterator));
-> [['some','text',true,false,0,1,2]]
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ make test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Harry Bragg](https://github.com/h-bragg)
- [All Contributors](../../contributors)
- Original Idea: [jfsimon/php-csv](https://github.com/jfsimon/php-csv)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

6

Last Release

3621d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/637788?v=4)[graze.com](/maintainers/graze)[@graze](https://github.com/graze)

---

Tags

parsercsvgrazecsv-token

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[faisalman/simple-excel-php

Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats

561606.4k1](/packages/faisalman-simple-excel-php)[rodenastyle/stream-parser

PHP Multiformat Streaming Parser

447204.3k2](/packages/rodenastyle-stream-parser)[avadim/fast-excel-reader

Lightweight and very fast XLSX Excel Spreadsheet and CSV Reader in PHP

107737.8k10](/packages/avadim-fast-excel-reader)[shuchkin/simplecsv

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

5198.0k](/packages/shuchkin-simplecsv)[csanquer/colibri-csv

Lightweight and performant CSV reader and writer library

16163.7k5](/packages/csanquer-colibri-csv)

PHPackages © 2026

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