https://github.com/czproject/csv-iterator
Simple reading of CSV files.
https://github.com/czproject/csv-iterator
csv-reader php
Last synced: 11 months ago
JSON representation
Simple reading of CSV files.
- Host: GitHub
- URL: https://github.com/czproject/csv-iterator
- Owner: czproject
- License: other
- Created: 2016-03-04T10:28:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-13T14:36:44.000Z (about 3 years ago)
- Last Synced: 2025-02-12T06:53:55.888Z (about 1 year ago)
- Topics: csv-reader, php
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.md
Awesome Lists containing this project
README
# CsvIterator
[](https://github.com/czproject/csv-iterator/actions)
[](https://packagist.org/packages/czproject/csv-iterator)
[](https://github.com/czproject/csv-iterator/releases)
[](https://github.com/czproject/csv-iterator/blob/master/license.md)
Simple reading of CSV files.
## Installation
[Download a latest package](https://github.com/czproject/csv-iterator/releases) or use [Composer](http://getcomposer.org/):
```
composer require czproject/csv-iterator
```
CsvIterator requires PHP 5.6.0 or later.
## Usage
```csv
id,name
1,Gandalf The White
```
```php
$iterator = new CzProject\CsvIterator\CsvIterator('/path/to/file.csv');
// optional:
$iterator->setDelimiter(',');
$iterator->setEnclosure('"');
$iterator->setEscape('\\');
$iterator->setEncoding('UTF-8');
while (($row = $iterator->fetch()) !== NULL) {
echo $row['id']; // prints '1'
echo $row['name']; // prints 'Gandalf The White'
}
```
------------------------------
License: [New BSD License](license.md)
Author: Jan Pecha, https://www.janpecha.cz/