shuchkin/simplecsv

Parse and retrieve data from CSV files. Export data to CSV.

0.1 2019-12-02 18:27 UTC

This package is auto-updated.

Last update: 2020-07-31 00:22:50 UTC


README

68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e742e7376673f75726c3d6874747073253341253246253246736869656c6473696f2d70617472656f6e2e6865726f6b756170702e636f6d25324673687563686b696e

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-2019

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

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

$ composer require shuchkin/simplecsv

or download class here


### Debug
```php
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