PHPackages                             lfphp/xlsxbuilder - 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. lfphp/xlsxbuilder

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

lfphp/xlsxbuilder
=================

Microsoft Excel Extend file library.

0.0.5(3y ago)010Apache-2.0PHPPHP &gt;=5.6

Since Dec 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sasumi/XLSXBuilder)[ Packagist](https://packagist.org/packages/lfphp/xlsxbuilder)[ Docs](http://blog.yikepi.com/)[ RSS](/packages/lfphp-xlsxbuilder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (6)Used By (0)

XLSX 生成库
========

[](#xlsx-生成库)

> 用于生成XLSX（ Open XML standard）格式文件。尤其在大量数据需要保存为Excel可读取文件时，可使用该生成库生成。可有效避免内存占用过大问题。

1. 安装
-----

[](#1-安装)

1. PHP 版本大于或等于 5.6
2. 必须安装扩展：mb\_string、php\_json、php\_zip

请使用Composer进行安装：

```
composer require lfphp/xlsxbuilder
```

2. 使用
-----

[](#2-使用)

注意：该库在使用过程依赖临时目录，用于存储生成过程的临时文件。

若需要指定该临时目录，请使用 `$writer->setTempDir()` 进行设置，缺省情况使用系统temp目录。

代码库使用方法：

```
//设置列格式
$header_types = array(
   'created'=>'date',
   'product_id'=>'string',
   'quantity'=>'#,##0',
   'amount'=>'price',
   'description'=>'string',
   'tax'=>'[$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00',
);
//数据
$data = array(
   array('2015-01-01',874234242342343,1,'44.00','misc','=D2*0.05'),
   array('2015-01-12',324,2,'88.00','none','=D3*0.05'),
);

$writer = new XLSXBuilder();
$sheet = $writer->createSheet('Sheet1'); //创建工作表 Sheet1
$sheet->setHeader($header_types);
foreach($data as $row){
   $writer->getSheet('Sheet1')->writeRow($row);
}
$writer->saveAs('example.xlsx');
```

3. 性能测试
-------

[](#3-性能测试)

测试项目数量耗时CPU峰值内存占用（峰值）环境csv文件转换1,000,00057秒14%4MBwin10+PHP7.3.5TS

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Total

5

Last Release

1267d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9944b00451fac65075c817cf981e9df2a1e8113f27066ba472a78ff86ce7f816?d=identicon)[sasumi](/maintainers/sasumi)

---

Top Contributors

[![sasumi](https://avatars.githubusercontent.com/u/166525?v=4)](https://github.com/sasumi "sasumi (7 commits)")

---

Tags

excelxlsx writerxlsx creatorxlsx builderspread sheet

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lfphp-xlsxbuilder/health.svg)

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

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k24.9M47](/packages/rap2hpoutre-fast-excel)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[mk-j/php_xlsxwriter

PHP Library to write XLSX files

1.9k8.1M27](/packages/mk-j-php-xlsxwriter)[shuchkin/simplexlsx

Parse and retrieve data from Excel XLSx files. MS Excel 2007 workbooks PHP reader.

1.8k3.8M21](/packages/shuchkin-simplexlsx)

PHPackages © 2026

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