承接 iyogesharma/csv 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

iyogesharma/csv

Composer 安装命令:

composer require iyogesharma/csv

包简介

README 文档

README

This package serves as a wrapper for CSV reading logic, handling all file reading automatically. You only need to provide a CSV file, and it will return the file data as an array.

Additionally, this package includes a Ys\Csv\Writer to facilitate downloading CSV files.

Read Csv File

    $file = $request->file('csv');

    $reader = new YS\Csv\Reader();

    $reader->importFromPath($file);

    //to read chunck of data

    $reader->chunk(2500)->fetch(true); 

    //the fetch function accept a boolean param bool $assoc with default value false, 
    //$assoc = true will fetch data as associated array with column name as key.
    //$assoc = false will return normal array


    // get number of rows in file $reader->getSize() 

    $rows = $reader->getRecords() // return generator you can interate over rows to access data

Download Csv File

    Writer::download($headers,$data,'filename');

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-12