popy-dev/php-csv
Composer 安装命令:
composer require popy-dev/php-csv
包简介
CSV manipulating tools for PHP
关键字:
README 文档
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) { // ... }
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-09