PHPackages                             xianacg/exceler - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. xianacg/exceler

ActiveLibary[PDF &amp; Document Generation](/categories/documents)

xianacg/exceler
===============

excel表格导入导出工具

1.0(1y ago)05MITPHPPHP ^7.3 || ^8.0

Since Nov 6Pushed 1y agoCompare

[ Source](https://github.com/xianacg/exceler)[ Packagist](https://packagist.org/packages/xianacg/exceler)[ RSS](/packages/xianacg-exceler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

exceler
=======

[](#exceler)

封装 phpspreadsheet 工具类

安装
--

[](#安装)

```
composer require ogenes/exceler
```

文档
--

[](#文档)

[wiki](https://github.com/ogenes/exceler/wiki)

简单读取
----

[](#简单读取)

```
    $config['sheet1'] = [
        'goodsName' => '商品名称',
        'color' => '颜色',
        'price' => '售价',
        'actualStock' => '实际库存',
    ];
    $filepath = __DIR__ . '/file/example.xlsx';
    return ExcelClient::getInstance()->read($filepath, $config);
```

DEMO
----

[](#demo)

```
## 可以再次封装定义企业内的Excel固定模板，
class ExcelHelper
{
    public static function export(array $data, array $config, string $filename): string
    {
        $client = ExportClient::getInstance();
        $fill = [
            'fillType' => Fill::FILL_GRADIENT_LINEAR,
            'startColor' => [
                'argb' => 'FFFE00',
            ],
            'endColor' => [
                'argb' => 'FFFE00',
            ]
        ];
        $client->setStyleHeaderFont([
                'name' => '宋体',
                'size' => 11,
                'bold' => true,
                'color' => ['argb' => '000000'],
            ])
            ->setStyleFont([
                'name' => '宋体',
                'size' => 10,
                'color' => ['argb' => '000000'],
            ])
            ->setStyleHeaderFill($fill);

        $client->setFreezeHeader(true);
       	return $client->setFilepath(storage_path('excel') . date('/Y/m/d/'))
                ->setFilename($filename)
                ->setData($data)
                ->setConfig($config)
                ->export();
    }

}
```

```
## 导出时定义好config即可。

$data['sheet1'] = $list;

$config['sheet1'] = [
  ['bindKey' => 'orderId', 'columnName' => '订单ID', 'width' => 20, 'align' => Alignment::HORIZONTAL_RIGHT],
  ['bindKey' => 'withdrawDate', 'columnName' => '交易日期', 'width' => 15, 'align' => Alignment::HORIZONTAL_LEFT],
  ['bindKey' => 'statusCn', 'columnName' => '订单状态', 'width' => 10, 'align' => Alignment::HORIZONTAL_LEFT],
  ['bindKey' => 'amount', 'columnName' => '订单金额(USD)', 'width' => 18, 'align' => Alignment::HORIZONTAL_RIGHT, 'format' => NumberFormat::FORMAT_NUMBER_00],
  ['bindKey' => 'cost', 'columnName' => '成本(USD)', 'width' => 18, 'align' => Alignment::HORIZONTAL_RIGHT, 'format' => NumberFormat::FORMAT_NUMBER_00],
  ['bindKey' => '={amount}-{cost}', 'columnName' => '收入(USD)', 'width' => 18, 'align' => Alignment::HORIZONTAL_RIGHT, 'format' => NumberFormat::FORMAT_NUMBER_00],
  ['bindKey' => '=({amount}-{cost})/{amount}', 'columnName' => '毛利率', 'width' => 18, 'align' => Alignment::HORIZONTAL_RIGHT, 'format' => NumberFormat::FORMAT_PERCENTAGE_00],
  ['bindKey' => 'uid', 'columnName' => '用户ID', 'width' => 30, 'align' => Alignment::HORIZONTAL_RIGHT],
  ['bindKey' => 'username', 'columnName' => '用户名', 'width' => 30, 'align' => Alignment::HORIZONTAL_LEFT],
  ['bindKey' => 'note', 'columnName' => '备注', 'width' => 30, 'align' => Alignment::HORIZONTAL_LEFT],

];
$filename = "收支明细" . date('YmdHis') . '.xlsx';
$fileFullpath = ExcelHelper::export($data, $config, $filename);
```

[![image-20220630132744221](https://camo.githubusercontent.com/3cb5479b2a937708495112f52fa4eb03e3b6958afb53df1ba793df69e95c3097/68747470733a2f2f6f67656e65732e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f696d672f323032322f3230323230363330313332373239332e706e67)](https://camo.githubusercontent.com/3cb5479b2a937708495112f52fa4eb03e3b6958afb53df1ba793df69e95c3097/68747470733a2f2f6f67656e65732e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f696d672f323032322f3230323230363330313332373239332e706e67)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

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

###  Release Activity

Cadence

Unknown

Total

1

Last Release

558d ago

### Community

Maintainers

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

---

Top Contributors

[![ogenes](https://avatars.githubusercontent.com/u/76425503?v=4)](https://github.com/ogenes "ogenes (10 commits)")[![johnYi-55](https://avatars.githubusercontent.com/u/131452464?v=4)](https://github.com/johnYi-55 "johnYi-55 (3 commits)")

---

Tags

excelPhpOfficephpspreadsheet

### Embed Badge

![Health badge](/badges/xianacg-exceler/health.svg)

```
[![Health](https://phpackages.com/badges/xianacg-exceler/health.svg)](https://phpackages.com/packages/xianacg-exceler)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[yidas/phpspreadsheet-helper

PHP Excel Helper - Write and read Spreadsheet with easy way based on PhpSpreadsheet

383144.5k3](/packages/yidas-phpspreadsheet-helper)

PHPackages © 2026

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