locr-company / csv-reader
A class for reading csv-files.
Installs: 1 964
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 4
Requires
- php: >=8.1
- ext-iconv: *
- locr-company/base-table-reader: ^1.0
Requires (Dev)
- captainhook/captainhook: ^5.23
- captainhook/hook-installer: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-deprecation-rules: ^2.0
- phpunit/phpunit: ^10.5
- saggre/phpdocumentor-markdown: ^0.1
- squizlabs/php_codesniffer: ^3.11
- dev-main
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-dependabot/composer/phpstan/phpstan-2.1.25
- dev-dependabot/composer/squizlabs/php_codesniffer-3.13.4
- dev-dependabot/composer/captainhook/captainhook-5.25.11
- dev-dependabot/composer/phpstan/phpstan-2.1.22
- dev-dependabot/composer/saggre/phpdocumentor-markdown-1.0.0
- dev-fixed_link
- dev-updates_for_php_8.4
This package is auto-updated.
Last update: 2025-09-15 06:28:58 UTC
README
1. Installation
composer require locr-company/csv-reader
2. How to use
Here are the Docs.
<?php use Locr\Lib\CsvReader; $csvReader = new CsvReader(); $csvReader->loadFile('file.csv'); $csvReader->setFirstLineIsHeader(true); // if the first line of the csv-file has column informations // read all rows at once $rows = $csvReader->readDataset(); foreach ($rows as $row) { print $row['column1'] . '|' . $row['column2'] . "\n"; } // read rows one by one, if you expect a very large csv-file $csvReader->readDatasetsCallback(function (array $row, int $lineNumber) { print $row['column1'] . '|' . $row['column2'] . "\n"; });
3. Development
Clone the repository
git clone git@github.com:locr-company/php-csv-reader.git cd php-csv-reader && composer install