PHPackages                             firezihai/z-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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. firezihai/z-excel

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

firezihai/z-excel
=================

通过注解解析和导出excel表格

v1.0.7(6mo ago)030GPL-3.0-or-laterPHPPHP &gt;=8.0

Since Nov 26Pushed 6mo ago1 watchersCompare

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

READMEChangelog (8)Dependencies (4)Versions (9)Used By (0)

Z-Excel
=======

[](#z-excel)

功能
--

[](#功能)

- 用于解析和导出表格
- 支持phpoffice、xlswriter

安装
--

[](#安装)

```
composer require firezihai/z-excel
```

使用
--

[](#使用)

### 定义DTO

[](#定义dto)

```
//index按表头索引解析表格，name：按表头名称解析表格，默认name
#[ExcelDto(type:"index")]
class UserDto implements ExcelDtoInterface
{
    // 导出表格无index时，属性在类中的顺序，即为表头的顺序
    #[ExcelHeader(name:"用户名",index:0)]
    public string $username;

    #[ExcelHeader(name:"昵称",index:1)]
    public string $nickname;

    #[ExcelHeader(name:"出生日期",index:3)]
    public string $birthday;

    #[ExcelHeader(name:"性别",index:2,formatter:true)]
    public string $gender;

    // 将性别转成中文
    public function formatterGender($value)
    {
        $gender = ['未知','男','女'];
        return $gender[$value]??'';
    }
}
```

### 解析表格

[](#解析表格)

```
$excelFactory = new ExcelFactory();
$excel = $excelFactory->get('phpOffice');
$data =  $excel->parse('./test.xlsx', UserDto::class);
```

> 注意 `xlswriter` 解析表格时，需安装 [xlswriter](https://github.com/viest/php-ext-xlswriter) 扩展

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance69

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

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 ~49 days

Recently: every ~1 days

Total

8

Last Release

184d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95ed582c23f06f22eb888b5c058dcf71433576112d21e7fc864cd26ef0644705?d=identicon)[firezihai](/maintainers/firezihai)

---

Top Contributors

[![firezihai](https://avatars.githubusercontent.com/u/9910490?v=4)](https://github.com/firezihai "firezihai (16 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/firezihai-z-excel/health.svg)

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M711](/packages/maatwebsite-excel)[phpoffice/phppresentation

PHPPresentation - Read, Create and Write Presentations documents in PHP

1.4k2.4M25](/packages/phpoffice-phppresentation)[kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

1623.1M35](/packages/kartik-v-yii2-export)[moonlandsoft/yii2-phpexcel

Exporting PHP to Excel or Importing Excel to PHP

1491.1M16](/packages/moonlandsoft-yii2-phpexcel)[yidas/phpspreadsheet-helper

PHP Excel Helper - Write and read Spreadsheet with easy way based on PhpSpreadsheet

383144.5k3](/packages/yidas-phpspreadsheet-helper)[yectep/phpspreadsheet-bundle

A Symfony bundle to integrate with PHPOffice's PhpSpreadsheet library

562.3M4](/packages/yectep-phpspreadsheet-bundle)

PHPackages © 2026

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