Yet another CSV parsing php package, but what makes it different?

So I'm a little bored with that state of most CSV parsing tools.
I'm not saying there aren't some good lib's, but, either they seem to me to focus on specific uses or they are a maze of awesome classes to work with CSV's in every way under the sun.

I simply want a Parser for literally input and output, thats taking in an array, a string or a file, and outputting a string, an array or file(s), and a CSV object to work with the data and have some helpers for mapping over the data columns or rows, adding/removing/sorting rows, that sort of thing.
Hell, most the time I'll probably just want the Parser, as in take this CSV file, and give me an array, or the reverse, but its useful to have that CSV object there for when i need it.

Anyway, that's what I've built, its a composer package up on packagist and github:


composer require stilliard/csvparser dev-master  

Example usage

$array = [['id'=>1, 'name'=>'Bob'],['id'=>2, 'name'=>'Bill']];
$parser = new \CsvParser\Parser();
$csv = $parser->fromArray($array);

So the workflow here is just create a parser, feed in the input and that gives you a CSV object, then you can either do some with with that or pass back over the the parser for the output.

comments powered by Disqus
Want to setup your own server? Digital Ocean offer $10 free for new accounts.