alexbrandes / simplecsv
Simple and flexible library for reading and manipulating CSV files in PHP.
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/alexbrandes/simplecsv
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-12-16 08:35:41 UTC
README
SimpleCsv is a simple and flexible library for reading and manipulating CSV files.
Usage
Read CSV from File
$csv = \Reader::create_from_file('./dat.csv');
Read CSV from String
$str = 'header 1, header 2 data 1, data 2'; $csv = \Reader::create_from_string($str);
CSV to Array
// associative array using first line as headers $csv = \Reader::create_from_file('./dat.csv') ->to_assoc(); // indexed array w/ no headers $csv = \Reader::create_from_file('./dat.csv') ->to_array();
Detect Delimiter
// automatically detect and set the file delimiter type $csv = \Reader::create_from_file('./dat.csv') ->detect_delimiter(array('|', '%', '$')) ->to_assoc();
Installation
Install the SimpleCsv package with Composer.
{
"require": {
"AlexBrandes/SimpleCsv": "*"
}
}
Read more about Composer
System Requirements
PHP >= 5.3.0
TODO
- Write to Csv
- Tests
Credits
- Written and maintained by Alex Brandes