tranquilo / parsecsv
A simple CSV parser, returns a multidimensional array. The class is very easy to install and use within a PSR compatiable psr compati
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires (Dev)
- phpunit/phpunit: 5.3.3
This package is not auto-updated.
Last update: 2024-05-26 03:54:10 UTC
README
##Parse-csv
Tranquilo Parse-csv is a miniscule PHP application library. The library allows you to pass a csv file where some validation is done to insure your data is given back within an array.
Installation
You can install this library using Composer:
$ composer require tranquilo/parsecsv This project requires PHP 5.5 and has no dependencies. The code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), and [PSR-4](http://www.php-fig.org/psr/psr-4/). If you find any issues related to standards compliance, please send a pull request!
Examples
Some examples.
<?php require __DIR__ . '/vendor/autoload.php'; use Tranquilo\ParseCsv; ///use Tranquilo\Exceptions\CsvException; try{ // filepath, delimiter : optional $csv = new ParseCsv(__DIR__ . '/test.csv', ","); // optional convert the encoding $csv->convertEncoding('UTF-8'); // // starts from 5 $withOffset = $csv->getWithOffset(5); // gets all rows $allRowsCsv = $csv->get(5); // gets 10 rows starting from 5 $withLimitAndOffset = $csv->get(5, 2); print_r($allRowsCsv); unset($csv); }catch(CsvException $e){ echo $e->getMessage(); }catch(Exception $e){ echo $e->getMessage(); }