Parse and retrieve data from CSV files. Export data to CSV.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
LICENSE
README.md
composer.json

README.md

SimpleCSV class 0.1

Parse and retrieve data from CSV files. Save array to CSV file. See XLSX reader here, XLS reader here,

Sergey Shuchkin sergey.shuchkin@gmail.com 2015-2018

Basic Usage

if ( $csv = SimpleCSV::import('book.csv') ) {
	print_r( $csv );
}
Array
(
    [0] => Array
        (
            [0] => ISBN
            [1] => title
            [2] => author
            [3] => publisher
            [4] => ctry
        )

    [1] => Array
        (
            [0] => 618260307
            [1] => The Hobbit
            [2] => J. R. R. Tolkien
            [3] => Houghton Mifflin
            [4] => USA
        )

)

Installation

$ composer require shuchkin/simplecsv

Debug

ini_set('error_reporting', E_ALL );
ini_set('display_errors', 1 );

$csv = SimpleCSV::import('books.csv');
print_r( $csv );

Export

$items = array(
	array('ISBN', 'title', 'author'),
	array('618260307','The Hobbit','J. R. R. Tolkien')
);
$csv = SimpleCSV::export( $items );
echo '<pre>' . $csv . '</pre>';
/*
ISBN,title,author
618260307,The Hobbit,J. R. R. Tolkien
*/

History

0.1 (2018-12-20) GitHub realese, composer