graze/csv-token

Tokenised Csv Reader

0.3.1 2016-08-01 10:23 UTC

This package is auto-updated.

Last update: 2024-10-24 04:52:16 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Tokenised Csv Reader that handles some of the strange configurations databases and application use.

  • Parses tokens and csv from streams and outputs using a Lazy Iterator

Install

Via Composer

$ composer require graze/csv-token

Usage

Simple reader

$csvDefinition = new CsvDefinition();
$reader = new Reader($csvDefinition, $stream);
$iterator = $reader->read();

More advanced parsing (with value parsers)

// $stream = '"some","text",true,false,0,1,2';
$csvDefiniton = new CsvDefinition();
$parser = new Parser([new BoolValueParser(), new NumberValueParser()]);
$tokeniser = new StreamTokeniser($csvDefinition, $stream);
$iterator = $parser->parser($tokeniser->getTokens());

var_dump(iterator_to_array($iterator));
-> [['some','text',true,false,0,1,2]]

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ make test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@graze.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.