ignatenkovnikita/little-csv-helper

v1.0 2018-03-24 17:48 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:28 UTC


README

Little CSV Helper

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ignatenkovnikita/little-csv-helper "*"

or add

"ignatenkovnikita/little-csv-helper": "*"

to the require section of your composer.json file.

Usage

Create class DbImporter or other class extends AbstractImporter and implements ImportInterface:

<?php
class DbImporter extends AbstractImporter implements ImportInterface
{
    public function import($data, $params){
        // your logic hear
    }
}
?>

And example how use class:

$importer = new CsvImporter();
$importer->setData(new CsvReader([
    'filename' => $fileName,
        'fgetcsvOptions' => [
    //  'delimiter' => '\n'
    ],
    'startFromLine' => 1
    ]));
$importerClass = new DbImporter();
$r = $importer->import($importerClass, ['type' => $type]);
echo $r