RFC : CSV conversion framework
| From: | Tristan Rivoallan | Date: | Wed, 10 Sep 2008 10:34:45 +0000 |
| Subject: | RFC : CSV conversion framework | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-50733@lists.php.net to get a copy of this message | ||
hi,
I coded a tiny CSV conversion framework for personal use, and i'm
willing to release it to the community. Would it be interesting to
have it as a PEAR package ?
Concept : a converter is given a csv conversion strategy instance and
uses it to convert the file.
Example :
// First parameter defines the csv file columns names
$converter = new CsvConverter(array('first_name', 'last_name',
'email'));
// Convert to HTML
$html_filepath = $converter->convert('/some/file.csv', new
CsvToHtmlConversionStrategy());
// Convert to PDF
$pdf_filepath = $converter->convert('/some/file.csv', new
CsvToPdfConversionStrategy());
Those are simplified examples. Real world usage (i use it to generate
printable index cards out of an excel product backlog) can be seen at
http://github.com/trivoallan/csvconverter/tree/master/bin/generate-scrum-cards.php
The code is currently available at http://github.com/trivoallan/csvconverter
If this code draws any interest, i'll happily turn it into a pear
package. File_CSV_Converter ?
regards,
tristan
--
http://www.mazemod.org
http://www.musiqueapproximative.net