PHP code example of belguinan / csv-simple-reader

1. Go to this page and download the library: Download belguinan/csv-simple-reader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

belguinan / csv-simple-reader example snippets


// Read csv file
$csv = new CsvExporter();
foreach ($csv->readFrom('test.csv') as $row) {
    var_dump($row);
}

// your array of data to process as csv
$data = ..;
$csv = new CsvExporter($data, $headers);

// Save your processed file.
$csv->process()->save('xxx/yyy/x.csv');

// Download your file.
$csv->process()->download('fileName');

// Download and save
$csv->process()->download('fileName')->save('xxxx/yyy/file.csv');