Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
/ php-csv Public archive
forked from keboola/php-csv

keboola/php-csvの日本語対応版

License

Notifications You must be signed in to change notification settings

WHITEPLUS/php-csv

 
 

Repository files navigation

Keboola CSV reader/writer Build Status

Latest Stable Version License Total Downloads

Usage

Read CSV

$csvFile = new Whiteplus\Csv\CsvFile(__DIR__ . '/_data/test-input.csv');
foreach($csvFile as $row) {
	var_dump($row);
}

Write CSV

$csvFile = new Keboola\Csv\CsvFile(__DIR__ . '/_data/test-output.csv');
$rows = array(
	array(
		'col1', 'col2',
	),
	array(
		'line without enclosure', 'second column',
	),
);

foreach ($rows as $row) {
	$csvFile->writeRow($row);
}

Installation

Library is available as composer package. To start using composer in your project follow these steps:

Install composer

curl -s http://getcomposer.org/installer | php
mv ./composer.phar ~/bin/composer # or /usr/local/bin/composer

Create composer.json file in your project root folder:

{
    "require": {
        "php" : ">=5.3.2",
        "whiteplus/csv": "1.2.*"
    }
}

Install package:

composer install

Add autoloader in your bootstrap script:

require 'vendor/autoload.php';

Read more in Composer documentation

Packages

No packages published

Languages

  • PHP 100.0%