fly321 / excel-annotation-export
excel导注解导出
v1.0.5
2024-05-09 13:36 UTC
Requires
- php: >=8.0
- phpoffice/phpspreadsheet: *
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-04-10 14:53:40 UTC
README
PHP版本要求 >= 8.0
仅支持PHP8注解方式
安装
composer require fly321/excel-annotation-export
使用方式
class FlyColumn { #[ExcelColumnAnnotation(columnWidth: 20, columnName: 'area', columnFieldMapping: '地区')] public string $area; #[ExcelColumnAnnotation(columnName: 'country', columnFieldMapping: '国家', columnWidth: 30)] public string $country; #[ExcelColumnAnnotation(columnName: 'title', columnFieldMapping: '标题', columnWidth: 40)] public string $title; }
writeOrExportExcel( \Tests\FlyColumn::class, 'fly_table', [ ['country' => 'China', 'title' => 'Beijing', 'area' => 'Asia'], ['area' => 'Asia', 'country' => 'Japan', 'title' => 'Tokyo'], ['area' => 'Europe', 'country' => 'France', 'title' => 'Paris'], ], true, "fly_table.xlsx");