tomaskarlik / csvutils
Format array to CSV
1.0
2018-05-12 16:00 UTC
Requires
- php: ^7.1
This package is not auto-updated.
Last update: 2024-11-08 19:18:03 UTC
README
Usage
$arrayToCsv = new ArrayToCsvString; $arrayToCsv->setIncludeBom(TRUE); $arrayToCsv->setHeader([ 'Header 1', 'Header 2', 'Header 3' ]); $arrayToCsv->addColumnCallback('price', [$this, 'formatFloat']); $arrayToCsv->addColumnCallback('sales', [$this, 'formatFloat']); $arrayToCsv->addColumnCallback('cost_of_sales', [$this, 'formatFloat']); $yourCsvInString = $arrayToCsv->convert($rows);