PHPackages                             aozeahj/excel-demo - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aozeahj/excel-demo

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aozeahj/excel-demo
==================

more demo for excel table fastly product which based on phpspreadsheet

v0.1.4(7y ago)134PHP

Since Nov 29Pushed 7y agoCompare

[ Source](https://github.com/aozeahj/excel-demo)[ Packagist](https://packagist.org/packages/aozeahj/excel-demo)[ RSS](/packages/aozeahj-excel-demo/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (6)Used By (0)

```
###1. 简介（brief intruoduction）
> ExcelDemo 是基于 spreadsheet excel 库做的封装，支持报表的快速生成，节约开发成本。

###2. 组成结构（structure）

* `src` 是源码文件夹
    * `Base.php` 是一个基类，实现类一些通用的方法
    * `NormalTable.php` 普通报表类，支持将输入的数据原生的写入excel中
    * `ReportFrom.php` 多维度合并报表类，支持对相同维度值进行行合并

* `test` 测试文件夹

###3. 使用方法（usage）

* 生成普通的表格类型 excel文件下载

        use ExcelDemo\NormalTable;

        $powerExcel = new NormalTable();

        //只生成一个sheet
        $sheet_title = ['姓名','班级'];//列名称
        $sheet_data  = [['张三','1304'],['李四', '1304']]; //数据
        $sheet_name  = '1304班级' // sheet 名
        $filename    = '学生明细' //文件名
        $save_path   = '/tmp' //excel 下载到本地，存放地址
        $is_down     = true //是否直接下载，true：直接web下载， false：保存到本地

        $powerExcel->singleSheet($sheet_title, $sheet_data, $filename, $sheet_name, $save_path, $is_down);

        //生成包含多个sheet excel文件
        $excel_data = [[
            'sheet_title' => $sheet_title,
            'sheet_data'  => $sheet_data,
            '$sheet_name' => $$sheet_name
        ],[
            'sheet_title' => $sheet_title,
            'sheet_data'  => $sheet_data,
            '$sheet_name' => $$sheet_name
        ]]

        $powerExcel->numerouseSheet($excel_data, $filename, $save_path, true);

* 支持报表中维度重复值合并类型 excel文件下载

        use ExcelDemo\ReportFrom;

        $powerExcel = new ReportFrom();

        //只生成一个sheet
        $sheet_title = ['城市','端','uv','pv']; //列名称
        $sheet_data  = [['北京','app',222,10000],['北京', 'app',333,40000],['北京', 'apph5',333,40000], ['上海', 'apph5',333,40000],['杭州', 'apph5',333,40000],['杭州', 'pc',333,40000]]; //数据
        $dim_cnt     = 2; //维度数量
        $sheet_name  = '城市维度用户分布' // sheet 名
        $filename    = '产品用户分析' //文件名
        $save_path   = '/tmp' //excel 下载到本地，存放地址
        $is_down     = true //是否直接下载，true：直接web下载， false：保存到本地

        $powerExcel->singleSheet($sheet_title, $dim_cnt, $sheet_data, $filename, $sheet_name, $save_path, $is_down);

        //生成包含多个sheet excel文件
        $excel_data = [[
            'sheet_title' => $sheet_title,
            'dim_cnt'    => $dim_cnt,
            'sheet_data'  => $sheet_data,
            '$sheet_name' => $$sheet_name
        ],[
            'sheet_title' => $sheet_title,
            'dim_cnt'    => $dim_cnt,
            'sheet_data'  => $sheet_data,
            '$sheet_name' => $$sheet_name
        ]]

        $powerExcel->numerouseSheet($excel_data, $filename, $save_path, true);

###4. 使用composer 加载

* 在composer.json require 中天添加 ` "aozeahj/excel-demo": "v0.1.3" `

* 运行命令 composer update

        {
            "require": {
                "aozeahj/excel-demo": "v0.1.3"
            }
        }

###5. 使用须知

* 维度行合并是只会合并邻近的相同维度值行，不会全局合并，这样数据排列的格式就由用户自定义，更加自由

* 所有的单元格在插入值的时候，默认都加了一个 ' ' 空格前缀，这是为了避免数字输入过长（超过11位）被写成科学记数法格式，加上空格前缀的好处是，接收到的数据都会当作字符串，从而保证数据不变

* excel文件中sheet名称，未传参数时，默认使用 sheet1，sheet2 .....
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Total

5

Last Release

2672d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2d019e4f643e523e138a0221da5c511bc14490e9008a695fcdf35086f7858a4?d=identicon)[aozeahj](/maintainers/aozeahj)

### Embed Badge

![Health badge](/badges/aozeahj-excel-demo/health.svg)

```
[![Health](https://phpackages.com/badges/aozeahj-excel-demo/health.svg)](https://phpackages.com/packages/aozeahj-excel-demo)
```

###  Alternatives

[civicrm/civicrm-core

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

728272.9k20](/packages/civicrm-civicrm-core)[in2code/powermail

Powermail is a well-known, editor-friendly, powerful and easy to use mailform extension for TYPO3 with a lots of features

982.5M38](/packages/in2code-powermail)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

44763.4k2](/packages/pimcore-data-importer)[portphp/spreadsheet

PhpSpreadsheet reader and writer for Port

14796.4k4](/packages/portphp-spreadsheet)

PHPackages © 2026

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