php-extended/php-export-csv

A library to export raw data into csv format


Keywords
php, data, csv, export
License
MIT

Documentation

php-export-csv

A library to export raw data into csv format

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-export-csv": "^2",
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

This library exports raw data into csv format. This library may be used the following way :


use PhpExtended\Export\CsvExportFormat;

$format = new CsvExportFormat();
$exported = $format->exportSimple($columns, $data);
// where columns is an array of column names, and data an
// associative array of data. 
// this also works :

$values = array_values($data);
$keys = array_keys($values);
$exported = $format->exportSimple($keys, $values);
// and $exported is now a string ready to be written to a file

License

MIT (See license file).