palmtree / csv
CSV Reader and Writer
v5.1.0
2026-11-15 18:09 UTC
Requires
- php: >=8.3
- ext-json: *
Requires (Dev)
- palmtree/php-cs-fixer-config: ^2.1
- phpstan/phpstan: ^2.3
- phpstan/phpstan-phpunit: ^2.1
- phpunit/phpunit: ^12.5||^13.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A CSV reader and writer for PHP.
The Reader class implements the Iterator interface, loading one line into memory at a time. This means large files can be parsed
without hitting any memory limits.
Requirements
- PHP >= 8.3
Installation
Use composer to add the package to your dependencies:
composer require palmtree/csv
Usage
use Palmtree\Csv\Reader; use Palmtree\Csv\Writer; foreach (new Reader('people.csv') as $row) { echo $row['name']; } Writer::write('people.csv', [ ['name' => 'Alice', 'age' => 24], ['name' => 'Bob', 'age' => 28], ]);
Documentation
See the documentation index for every topic, or jump to a page:
See the examples directory for more usage examples.
License
Released under the MIT license