saverty/csv-parser

There is no license information available for the latest version (dev-dev-master) of this package.

Parse csv files

dev-dev-master 2018-06-13 14:53 UTC

This package is auto-updated.

Last update: 2024-09-16 07:03:54 UTC


README

Csv parser is used to manipulate a CSV File.

Examples

Download csv-parser using Composer

https://packagist.org/packages/saverty/csv-parser

foo@bar:~$ composer require saverty/csv-parser

include the package

require __DIR__ . "/vendor/autoload.php";

use Saverty\CsvParser\CsvParser;

Transform a CSV to an indexed array

$csv = new CsvParser('nlp.csv');
$array = $csv->toArray();

Transform a CSV to a JSON String

$csv = new CsvParser('nlp.csv');
$json = $csv->toJson();

Transform a CSV to an array that contains object

$csv = new CsvParser('nlp.csv');
$object = $csv->toObject();

Get headers of the CSV

$csv = new CsvParser('nlp.csv');
$headers = $csv->getHeaders();