Reading each lines data from file (.txt, .csv, .xls, .xlsx). The library using PHP Generator then input file will be read line by line to avoid store total file data in memory.
Because of using Generator for iterate over input file's rows. DO NOT BREAK the loop while iterate over file's rows it will cause unexpected behavior.
<?php
use Kentreez\EasyFileReader\EasyFileReader;
require_once 'vendor/autoload.php';
$easy = EasyFileReader::Read('example.xlsx');
// count all rows
$easy->count();
// iterate over rows in input file
foreach ($easy->rows() as $rows) {
print_r($rows);
}
// if we interest only first column of each row then
foreach ($easy->firstColumns() as $str) {
echo $str . PHP_EOL;
}
?>