PHPackages                             yzh52521/thinkcsv - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yzh52521/thinkcsv

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yzh52521/thinkcsv
=================

支持并发百万的协程场景导出csv,csv处理组件,导入导出csv

1.0.0(5y ago)2111Apache-2.0PHPPHP &gt;=7.1.0

Since Apr 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/yzh52521/thinkcvs)[ Packagist](https://packagist.org/packages/yzh52521/thinkcsv)[ Docs](https://github.com/yzh52521/thinkcsv)[ RSS](/packages/yzh52521-thinkcsv/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

处理CSV类库 thinkcsv
================

[](#处理csv类库-thinkcsv)

csv导入,导出,读取

安装
--

[](#安装)

> composer require yzh52521/thinkcsv

### 使用

[](#使用)

```
    //引入
    use yzh52521\ThinkCsv;

    //浏览器渲染导出csv
    $header = ['姓名', '性别', '手机号'];
    $data = [
        ['小明', '男', 17699019191],
        ['小红', '男', 17699019191],
        ['小黑', '女', 17699019191],
        ['小白', '女', 17699019191],
    ];
    //浏览器访问渲染下载
    $csv = new ThinkCsv('demo.csv',$header,$data);
    $csv->export();

    //后端执行,无需浏览器访问,本例文件生成在   /网站根目录/upload/demo.csv
    $csv = new ThinkCsv('upload/demo.csv',$header,$data);
    $csv->csvtoFile();

    //读取文件 $filepath文件路径
    $filepath = 'public/demo.csv';
    $data = ThinkCsv::readCsvData($filepath);

    //携程导出
    $arr = [];
        $num = 0;
        for ($i = 0; $i < 2080000; $i++) {
            $arr[] = [
                '测试1',
                '测试2',
                '测试3',
                '测试4',
            ];
            if (count($arr) === 1040000) {
                $num++;
                ThinkCsv::createMoreDataToCsvFile(
                    $arr,
                    app()->getRootPath() . 'public/',
                    '测试',
                    function ($arr) {
                        return $arr;
                    },
                    [
                        'headerRow' => [
                            '测试列数1',
                            '测试列数2',
                            '测试列数3',
                            '测试列数4',
                        ],
                        'num'       => $num,
                    ]
                );
                $arr = [];
            }
        }

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1847d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15060466?v=4)[听风吹雨](/maintainers/yuanzhihai)[@yuanzhihai](https://github.com/yuanzhihai)

---

Top Contributors

[![yuanzhihai](https://avatars.githubusercontent.com/u/15060466?v=4)](https://github.com/yuanzhihai "yuanzhihai (3 commits)")

### Embed Badge

![Health badge](/badges/yzh52521-thinkcsv/health.svg)

```
[![Health](https://phpackages.com/badges/yzh52521-thinkcsv/health.svg)](https://phpackages.com/packages/yzh52521-thinkcsv)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
