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(7mo ago)030GPL-3.0-or-laterPHPPHP &gt;=8.0

Since Nov 26Pushed 7mo 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 today

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

33

—

LowBetter than 72% of packages

Maintenance62

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

238d 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.9k157.3M892](/packages/maatwebsite-excel)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[yajra/laravel-datatables-export

Laravel DataTables Queued Export Plugin.

362.2M4](/packages/yajra-laravel-datatables-export)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k18](/packages/solspace-craft-freeform)

PHPackages © 2026

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