A library to export raw data into csv format
A library to export raw data into csv format
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.
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
MIT (See license file).