Skip to content

kentreez/easy-file-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyFileReader

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.

*** Caution ***

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.

Usage:

<?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;
    }
?>

About

Simple way for reading .txt, .msv, .xls, .xlsx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages