ignatenkovnikita / little-csv-helper
Little CSV Helper
Installs: 2 212
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- yiisoft/yii2: ~2.0.0
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