popy-dev / php-csv
CSV manipulating tools for PHP
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/popy-dev/php-csv
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-12-17 20:13:19 UTC
README
It is a fully object-oriented CSV reading (soon writing) toolkit, providing various classes to ease CSV file manipulations
Installation
php composer.phar require popy-dev/php-csv:dev-master
Documentation
Basic usage
<?php use Popy\Csv\Reader\SplFileInfoReader; $file = new SplFileInfo('/path/to/file.csv'); $reader = new SplFileInfoReader($file); foreach ($reader as $key => $value) { // ... }
Dealing with Microsoft encodings ?
<?php use Popy\Csv\Reader\CharsetConverterReader; $rawReader = ...; // Initialize any reader you want (SplFileInfoReader for instance) $reader = new CharsetConverterReader($rawReader, 'Windows-1252', 'UTF-8'); foreach ($reader as $key => $value) { // ... }
Want named columns ?
Fixed column headers
<?php use Popy\Csv\Reader\NamedColumnReader; $rawReader = ...; // Initialize any reader you want (SplFileInfoReader for instance) $reader = new NamedColumnReader($rawReader, array('col1', 'col2')); foreach ($reader as $key => $value) { // ... }
Alternative : Use first row as column names
<?php use Popy\Csv\Reader\AutoNamedColumnReader; $rawReader = ...; // Initialize any reader you want (SplFileInfoReader for instance) $reader = new AutoNamedColumnReader($rawReader); foreach ($reader as $key => $value) { // ... }