diff --git a/README.md b/README.md index ec73637..908399f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,13 @@ foreach($csvFile as $row) { Skip the first line: ```php -$csvFile = new \Keboola\Csv\CsvFile($fileName, CsvFile::DEFAULT_DELIMITER, CsvFile::DEFAULT_ENCLOSURE, CsvFile::DEFAULT_ESCAPED_BY, 1) +$csvFile = new \Keboola\Csv\CsvFile( + $fileName, + CsvFile::DEFAULT_DELIMITER, + CsvFile::DEFAULT_ENCLOSURE, + CsvFile::DEFAULT_ESCAPED_BY, + 1 +) foreach($csvFile as $row) { var_dump($row); } @@ -71,6 +77,29 @@ foreach ($rows as $row) { fclose($file); ``` +### Write CSV With Windows new-lines + +```php +$csvFile = new Keboola\Csv\CsvWriter( + 'test-output.csv', + CsvWriter::DEFAULT_DELIMITER, + CsvWriter::DEFAULT_ENCLOSURE, + "\r\n" +) +$rows = [ + [ + 'col1', 'col2', + ], + [ + 'first column', 'second column', + ], +]; + +foreach ($rows as $row) { + $csvFile->writeRow($row); +} +``` + ## Installation The library is available as [composer package](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).