chinahub/xls-writer
Composer 安装命令:
composer require chinahub/xls-writer
包简介
php xls library based on xlsWriter
README 文档
README
php xls library based on xlsWriter, php-xlsWriter:https://github.com/viest/php-ext-xlswriter
Installation
Run the following command to install the latest applicable version of the package:
composer require chinahub/xls-writer
Env Required
xlswriterextention
pecl install xlswriter
# add extension = xlswriter.so to php.ini
- recommend
PHP> 7.4
Usage
Export
use Chinahub\XlsWriter\interfaces\ExportInterface; class UserExport implements ExportInterface { public function headers(): array { return ['id','name','email']; } public function data(): array { return [ [1,'tom','test@qq.com'], [2,'lily','test@gmail.com'], [3,'lisa','test@163.com'], ]; } }
output path
use Chinahub\XlsWriter\Export; $excel = new Export(new UserExport()); $excel->config = ['path' => '/www']; $excel->fileName = 'user.xlsx'; $excel->output();
output download
use Chinahub\XlsWriter\Export; $excel = new Export(new UserExport()); $excel->fileName = 'user.xlsx'; $excel->download();
Import
get all data from sheet
use Chinahub\XlsWriter\Import; $excel = new Import('/www/user.xlsx'); $excel->getSheet();
get row from sheet
use Chinahub\XlsWriter\Import; $excel = new Import('/www/user.xlsx'); $excel = $excel->instance(); while (($row = $excel->nextRow()) !== NULL) { var_dump($row); }
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-13