PHPackages                             wccplatform/phalapi-excel - 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. wccplatform/phalapi-excel

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

wccplatform/phalapi-excel
=========================

PHP execl处理，专门用于PhalApi 2.x 开源接口框架。

1631PHP

Since May 21Pushed 6y agoCompare

[ Source](https://github.com/wccplatform/phalapi-execl)[ Packagist](https://packagist.org/packages/wccplatform/phalapi-excel)[ RSS](/packages/wccplatform-phalapi-excel/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

**本版本借助于PhalApi 1.0 的PHPExcel拓展 已将PHPExecl升级成1.8.1 解决 break php7报错 我只是搬运工稍作修改**

\#PhalApi-PHPExcel基于PhalApi 2.0 的PHPExcel拓展

[![](https://camo.githubusercontent.com/d17444d1c116ba8de47ca5f2d1550a5076c737e97beff214dca622d75b668533/687474703a2f2f776562746f6f6c732e71696e6975646e2e636f6d2f6d61737465722d4c4f474f2d32303135303431305f35302e6a7067)](https://camo.githubusercontent.com/d17444d1c116ba8de47ca5f2d1550a5076c737e97beff214dca622d75b668533/687474703a2f2f776562746f6f6c732e71696e6975646e2e636f6d2f6d61737465722d4c4f474f2d32303135303431305f35302e6a7067)

\##前言

在之前有提供过一个PhalApi-Excel拓展来提供导出,但是还是有一些不方便,比如没有导入,导出文件体积过大此类问题,也是应为自身业务有使用到重新来提供一个PHPExcel的拓展 来提供更为强大的Excel处理功能

附上:

官网地址:[http://www.phalapi.net/](http://www.phalapi.net/ "PhalApi官网")

开源中国Git地址:[http://git.oschina.net/dogstar/PhalApi/tree/release](http://git.oschina.net/dogstar/PhalApi/tree/release "开源中国Git地址")

开源中国拓展Git地址:[http://git.oschina.net/dogstar/PhalApi-Library](http://git.oschina.net/dogstar/PhalApi-Library "开源中国Git地址")

\##1. 安装

```
"require": {
    "ctbsea/phalapi-excel" : "*"
},

```

\##2. 初始化

```
在di.php加入
$di->execl = function() {
    return new \ctbsea\phalapiExcel\Lite();
};

```

\##3. 使用

PhalApi-PHPExcel提供三个基础封装好的方法分别是exportExcel,exportExcelNew,importExcel分表接触导出和接受的问题

exportExcel接受三个参数,$data基础数据,$headArr标题,$filename文件名称下面是一个例子

```
   $data=array(
        array('username'=>'zhangsan','password'=>"123456"),
        array('username'=>'lisi','password'=>"abcdefg"),
        array('username'=>'wangwu','password'=>"111111"),
    );

    $filename    = "test_excel.xlsx";
    $headArr     = array("用户名", "密码");

    \PhalApi\DI()->execl->exportExcel($filename, $data, $headArr);

```

PhalApi-PHPExcel可根据导出的文件后缀来导出不同格式的Excel文档

exportExcelNew接受三个参数,$data基础数据,$headArr标题,$filename文件名称下面是一个例子

```
   $data=array(
        array('username'=>'zhangsan','password'=>"123456"),
        array('username'=>'lisi','password'=>"abcdefg"),
        array('username'=>'wangwu','password'=>"111111"),
    );

    $filename    = "test_excel.xlsx";
    $headArr     = array('username'=>'用户名', 'password'=>'密码');

    \PhalApi\DI()->execl->exportExcel($filename, $data, $headArr);

```

exportExcelNew是exportExcel的优化，两者唯一的不同就是$headArr的参数，exportExcelNew可以根据headArr来写入与表头对应的数值，$data的key顺序可以随意。

importExcel接受三个参数,$filename文件名称,$firstRowTitle标题(可选默认从第一行作为标题),$Sheet工作表(默认第一张工作表)

```
$rs = \PhalApi\DI()->execl->importExcel("./test.xlsx");

```

**当然PHPExcel是一个强大的工具可以通过$PHPExcel-&gt;getPHPExcel();获得完整的PHPExcel实例自由使用**

\##4. 总结

希望此拓展能够给大家带来方便以及实用,如有其他童鞋希望能加入其余常用功能可与笔者进行联系!

注:笔者能力有限有说的不对的地方希望大家能够指出,也希望多多交流!

**官网QQ交流群:421032344 欢迎大家的加入!**

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42161739?v=4)[wccplatform](/maintainers/wccplatform)[@wccplatform](https://github.com/wccplatform)

---

Top Contributors

[![wccplatform](https://avatars.githubusercontent.com/u/42161739?v=4)](https://github.com/wccplatform "wccplatform (9 commits)")[![jiaoyang3](https://avatars.githubusercontent.com/u/37996610?v=4)](https://github.com/jiaoyang3 "jiaoyang3 (1 commits)")

### Embed Badge

![Health badge](/badges/wccplatform-phalapi-excel/health.svg)

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

###  Alternatives

[austinhyde/iniparser

A Zend\_Config\_Ini like parser for .ini files.

6845.5k1](/packages/austinhyde-iniparser)

PHPackages © 2026

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