Skip to content

uenoryo/csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Library for using csv file (`・ω・´)

Installation

You can use Composer or simply Download the Release.

    composer require ryoueno/csv

Usage

[0] Get csv ready.

    id, name,
    1, "UDON",
    2, "SHUSHI",
    ・
    ・
    ・

[1] Make src instance just to set your path of csv file.

    $src = new \Gojiro\Src('path/to/MyCSV.csv');

[2] Make instance of csv by setting it.

    $csv = new \Gojiro\Csv($src);

[3] Get data.

    $csv->get();
    /*
        [
            0 => [
                'id' => 1,
                'name' => 'UDON',
            ],
            1 => [
                'id' => 2,
                'name' => 'SHUSHI',
            ]
            .
            .
            .
        ]
    */

[4] You can use select/where query like DB language.

    $csv->select(['name'])->where->(['id' => 2])->get();
    /*
        [
            1 => [
                'name' => 'SHUSHI',
            ]
        ]
    */