avadim/fast-excel-writer
Composer 安装命令:
composer require avadim/fast-excel-writer
包简介
Lightweight and very fast XLSX Excel Spreadsheet Writer in PHP
README 文档
README
![]() |
FastExcelWriter v.6 |
FastExcelWriter is a part of the FastExcelPhp Project which consists of
- FastExcelWriter - to create Excel spreadsheets
- FastExcelReader - to read Excel spreadsheets
- FastExcelTemplator - to generate Excel spreadsheets from XLSX templates
- FastExcelLaravel - special Laravel edition
Introduction
Lightweight, powerful and very fast XLSX Spreadsheet Writer in pure PHP. This library is designed to be super-fast and requires minimal memory usage.
FastExcelWriter creates spreadsheets in XLSX format, compatible with MS Excel (Office 2007+), LibreOffice, OpenOffice and others, with many features supported:
- Takes UTF-8 encoded input
- Multiple worksheets
- Supports currency/date/numeric cell formatting, formulas and active hyperlinks
- Supports most styling options for cells, rows, columns - colors, borders, fonts, etc.
- You can set the height of the rows and the width of the columns (including auto width calculation)
- You can add formulas, notes and images in you XLSX-files
- Supports workbook and sheet protection with/without passwords
- Supports page settings - page margins, page size
- Inserting multiple charts
- Supports data validations and conditional formatting
PHP Version Support
Currently, the required PHP minimum version is PHP 7.4
Documentation
Read more in the documentation here or here.
Or check out the API reference.
Also, you can see examples in /demo folder.
Changelog is here.
Installation
Use composer to install FastExcelWriter into your project:
composer require avadim/fast-excel-writer
Changes In Version 6
- Data Validation support
Important changes in version 6.1
Sheet::setRowOptions(),Sheet::setColOptions(),Sheet::setRowStyles()andSheet::setColStyles()are deprecated, instead of them you should use other functions:setRowStyle(),setRowStyleArray(),setRowDataStyle(),setRowDataStyleArray(),setColStyle(),setColStyleArray(),setColDataStyle(),setColDataStyleArray()- The behavior of the
Sheet::setRowStyle()andSheet::setColStyle()has changed, they now set styles for the entire row or column (even if they are empty)
Changes In Version 5
- The general news is Chart support
Important changes in version 5.8
Before v.5.8
$sheet->writeCell(12345); // The number 12345 will be written into the cell $sheet->writeCell('12345'); // The number 12345 will also be written here
In version 5.8 and later
$sheet->writeCell(12345); // The number 12345 will be written into the cell $sheet->writeCell('12345'); // Here the string '12345' will be written into the cell
If you want to keep the previous behavior for backward compatibility, you should use option 'auto_convert_number' when creating a workbook.
$excel = Excel::create(['Sheet1'], ['auto_convert_number' => true]); $sheet = $excel->sheet(); $sheet->writeCell('12345'); // String '12345' will be automatically converted to a number
Changes In Version 4
- Now the library works even faster
- Added a fluent interface for applying styles.
- New methods and code refactoring
FastExcelWriter vs PhpSpreadsheet
PhpSpreadsheet is a perfect library with wonderful features for reading and writing many document formats. FastExcelWriter can only write and only in XLSX format, but does it very fast and with minimal memory usage.
FastExcelWriter:
- 7-9 times faster
- uses less memory by 8-10 times
- supports writing huge 100K+ row spreadsheets
Benchmark of PhpSpreadsheet (generation without styles)
| Rows x Cols | Time | Memory |
|---|---|---|
| 1000 x 5 | 0.98 sec | 2,048 Kb |
| 1000 x 25 | 4.68 sec | 14,336 Kb |
| 5000 x 25 | 23.19 sec | 77,824 Kb |
| 10000 x 50 | 105.8 sec | 256,000 Kb |
Benchmark of FastExcelWriter (generation without styles)
| Rows x Cols | Time | Memory |
|---|---|---|
| 1000 x 5 | 0.19 sec | 2,048 Kb |
| 1000 x 25 | 1.36 sec | 2,048 Kb |
| 5000 x 25 | 3.61 sec | 2,048 Kb |
| 10000 x 50 | 13.02 sec | 2,048 Kb |
Do you want to support FastExcelWriter?
if you find this package useful you can support and donate to me for a cup of coffee:
- USDT (TRC20) TSsUFvJehQBJCKeYgNNR1cpswY6JZnbZK7
- USDT (ERC20) 0x5244519D65035aF868a010C2f68a086F473FC82b
- ETH 0x5244519D65035aF868a010C2f68a086F473FC82b
Or just give me a star on GitHub :)
avadim/fast-excel-writer 适用场景与选型建议
avadim/fast-excel-writer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.42M 次下载、GitHub Stars 达 305, 最近一次更新时间为 2020 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「excel」 「spreadsheet」 「xls」 「xlsx」 「library」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 avadim/fast-excel-writer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 avadim/fast-excel-writer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 avadim/fast-excel-writer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
Yii2 export extension
PHP Excel Library
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
统计信息
- 总下载量: 1.42M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 305
- 点击次数: 27
- 依赖项目数: 8
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-01






