graze / csv-token
Tokenised Csv Reader
0.3.1
2016-08-01 10:23 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- akamon/mockery-callable-mock: ^1.0
- graze/standards: ^1.0
- mockery/mockery: ^0.9.4
- phpunit/phpunit: 5.*
- squizlabs/php_codesniffer: ^2.5
README
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
- Harry Bragg
- All Contributors
- Original Idea: jfsimon/php-csv
License
The MIT License (MIT). Please see License File for more information.