PHPackages                             chenvle/easy\_excel - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. chenvle/easy\_excel

ActiveLibrary[File &amp; Storage](/categories/file-storage)

chenvle/easy\_excel
===================

v1.1.4(2y ago)32591[1 PRs](https://github.com/chenvle/easy_excel/pulls)MITPHPPHP &gt;=7.0.0

Since Oct 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/chenvle/easy_excel)[ Packagist](https://packagist.org/packages/chenvle/easy_excel)[ RSS](/packages/chenvle-easy-excel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (16)Used By (0)

简易Excel导入和导出

1、安装

```
composer require chenvle/easy_excel

```

2、使用例子

```
use Chenvle\EasyExcel\EasyExcel;

$excel = new Excel();

```

```
/*导入*/
$var   = [
    'A' => ['key' => 'username', 'title' => '姓名'],
    'B' => ['key' => 'phone', 'title' => '电话'],
    'C' => ['key' => 'origOrderId', 'title' => '订单号'],
    'D' => ['key' => 'txnAmt', 'title' => '订单金额'],
    'E' => ['key' => 'refundAmt', 'title' => '退款金额'],
    'F' => ['key' => 'remark', 'title' => '备注'],
];
$filepath = '';
// 1、excel表路径  2、每列对应数据键名及标题  3、内容开始的行
$excelData  = $excel->input($filepath, $var, 2);

```

```
/*导入的格式*/
$var = [
    '列'=>['key'=>'英文命名','title'=>'中文命名'],
    ...
]
注意：
    中文命名必须跟文档中的命名一致，英文命名可自定义

```

```
/*导出*/
$field  = [
    'username'    => ['value' => '姓名', 'width' => '15', 'type' => 'string'],
    'school_str'  => ['value' => '学校', 'width' => '15', 'type' => 'string'],
    'grade'       => ['value' => '年级', 'width' => '10', 'type' => 'string'],
    'origOrderId' => ['value' => '订单号', 'width' => '25', 'type' => 'string'],
    'phone'       => ['value' => '电话', 'width' => '15','type'=>'int'],
    'txnAmt'      => ['value' => '订单金额', 'width' => '15'],
    'refundAmt'   => ['value' => '退款金额', 'width' => '15'],
    'status_str'  => ['value' => '状态', 'width' => '10', 'type' => 'string','color'=>'ff0000'],
    'remark'      => ['value' => '备注', 'width' => '15', 'type' => 'string','max'=>'50'],
    'create_time' => ['value' => '下单时间', 'width' => '20', 'type' => 'string']
];
$str    = '待退款表';

//导出的数据，如果是对象需要转换成数组，提高性能
$data = [];

//返回到浏览器，文件流形式
$excel->output($data, $str, $field,'Xlsx');

//保存到服务器返回路径(前面不用'/'，后面也不用"/")
$excel->output($data, $str, $field,'Xlsx','upload');

```

```
/*导出field参数*/
$field = [
    '字段'=>[
            'value'=>'字段命名',
            'width'=>'宽度',
            'type'=>'string字符串|int整型|array数组',
            'max'=>'长度,超过截取',
            'color'=>'字体颜色',
        ]
    ...
]
注意：
    字段必须要存在数据中，value字段命名用于导出的命名可自定义，type类型中string会自动在后面增加空格，
    int不做处理，array用'、'分隔，max长度用于截取长字段,color字体颜色rgb

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Every ~38 days

Recently: every ~92 days

Total

15

Last Release

774d ago

Major Versions

v0.1.0 → v1.0.02022-10-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a10b8df94431dd036534312682798432bdafcc527c2076512eaf44db617fa47?d=identicon)[chenvle](/maintainers/chenvle)

---

Top Contributors

[![chenvle](https://avatars.githubusercontent.com/u/41420442?v=4)](https://github.com/chenvle "chenvle (32 commits)")

### Embed Badge

![Health badge](/badges/chenvle-easy-excel/health.svg)

```
[![Health](https://phpackages.com/badges/chenvle-easy-excel/health.svg)](https://phpackages.com/packages/chenvle-easy-excel)
```

PHPackages © 2026

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