filmtools / parser
1.1.1
2019-08-31 19:20 UTC
Requires
- php: ^7.1
- league/csv: ^9.2
- webuni/front-matter: ^1.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^5.7|^6.0|^7.0
- spatie/phpunit-watcher: ^1.8
This package is auto-updated.
Last update: 2024-11-29 05:56:56 UTC
README
Installation
$ composer require filmtools/parser
Usage
Creating the Parser object
<?php use FilmTools\Parser\ParserFactory; use FilmTools\Parser\ParserExceptionInterface; $factory = new ParserFactory; try { $parser = $factory("data.csv"); } catch (ParserExceptionInterface $e) { echo $e->getMessage(); // "Invalid file extension ..." }
Parsing the data
try { $records = $parser->parse("data.csv"); $records = $parser->parseString( file_get_contents("data.csv")); foreach($records as $row): // Do things with \Traversable endforeach; } catch (ParserExceptionInterface $e) { echo $e->getMessage(); // "File not found ..." // or s.th. like that }
Unit Tests
Nope, sorry … cough …