1. Go to this page and download the library: Download wilgucki/php-csv 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/ */
wilgucki / php-csv example snippets
$reader = new Reader();
$reader->open('/path/to/file.csv');
$reader = new Reader();
$reader->open('/path/to/file.csv');
$reader->addConverter(3, new DateToCarbon());
$data = $reader->readLine();
$reader = new Reader();
$reader->open('/path/to/file.csv');
print_r($reader->readLine());
/*
Array
(
[0] => user_id
[1] => name
)
*/
print_r($reader->readLine());
/*
Array
(
[0] => 1
[1] => john
)
*/