adambisek / io-table
v1.0.0
2016-04-28 18:53 UTC
This package is not auto-updated.
Last update: 2024-12-21 19:05:47 UTC
README
Save Array to CSV file or parse CSV file into Array
Installation
Preferred installation is with Composer.
composer require adambisek/io-table
Usage
$parser = new \IoTable\Parsers\CsvParser();
$table = new \IoTable\Table();
$table->setParser($parser);
$table->loadFromString("sloupec;druhy sloupec\nsl v novem radku;a dalsi");
$rows = $table->getRows();
var_dump($rows);
$csv = $table->toString();
var_dump($csv);
$parser = new \IoTable\Parsers\CsvParser();
$table = new \IoTable\Table();
$table->setParser($parser);
$table->load([["sloupec", "druhy sloupec"], ["sl v novem radku", "a dalsi"]]);
$string = $table->toString();
var_dump($string);
Parser test (for maintainer only)
$p = new \IoTable\Parsers\CsvParser();
$r = $p->parse("sloupec;druhy sloupec\nsl v novem radku;a dalsi");
var_dump($r);
$r = $p->toString([["sloupec", "druhy sloupec"], ["sl v novem radku", "a dalsi"]]);
var_dump($r);