pingpong/csv-reader
最新稳定版本:1.0.0
Composer 安装命令:
composer require pingpong/csv-reader
包简介
Laravel 4 - Csv Reader
README 文档
README
Server Requirement
This package is require PHP 5.4 or higher.
Installation
Open your composer.json file, and add the new required package.
"pingpong/csv-reader": "1.0.*"
Next, open a terminal and run.
composer update
Next, Add new aliases in app/config/app.php.
'CsvReader' => 'Pingpong\CsvReader\Facades\CsvReader',
Done.
Usage
Create new instance.
$path = app_path('file.csv'); $csv = CsvReader::get($path); // OR $csv = CsvReader::make($path);
Get data.
$data = $csv->getData();
Get data as array.
$data = $csv->toArray();
Get data as json.
$data = $csv->toJson();
Get data as object.
$data = $csv->toObject();
Looping.
foreach($csv as $item) { var_dump($item); }
Without Laravel
Basically all functions and APIs same as above.
$path = __DIR__ . '/path/to/csvfile.csv'; $csv = new Pingpong\CsvReader\CsvReader($path); $data = $csv->getData();
License
This package is open-sourced software licensed under The BSD 3-Clause License
统计信息
- 总下载量: 21.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-08-21