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

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

exinfinite/excel
================

excel操作

1.1.0(5y ago)08LGPL-2.1PHPPHP ^5.6

Since Nov 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/exinfinite/Excel)[ Packagist](https://packagist.org/packages/exinfinite/excel)[ RSS](/packages/exinfinite-excel/feed)WikiDiscussions master Synced 1w ago

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

excel op by phpexcel
====================

[](#excel-op-by-phpexcel)

[![Packagist PHP Version Support](https://camo.githubusercontent.com/2405553e9bdf542fa15215072ea2bc9ad4b6dada4a2fbb069d45a0b041cf0902/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6578696e66696e6974652f457863656c)](https://camo.githubusercontent.com/2405553e9bdf542fa15215072ea2bc9ad4b6dada4a2fbb069d45a0b041cf0902/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6578696e66696e6974652f457863656c)[![GitHub release (latest SemVer)](https://camo.githubusercontent.com/696f3e0f87eeeae34cd9649d9df8eff62703eb357ddc4855df77bf4f9025c1ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6578696e66696e6974652f457863656c)](https://camo.githubusercontent.com/696f3e0f87eeeae34cd9649d9df8eff62703eb357ddc4855df77bf4f9025c1ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6578696e66696e6974652f457863656c)[![Packagist Version](https://camo.githubusercontent.com/7a184ec24e990a57de831d848d56b1311a84f49dfc4f4f26a5fbe5eba5fed9a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6578696e66696e6974652f457863656c)](https://camo.githubusercontent.com/7a184ec24e990a57de831d848d56b1311a84f49dfc4f4f26a5fbe5eba5fed9a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6578696e66696e6974652f457863656c)[![Packagist Downloads](https://camo.githubusercontent.com/a511b380b737250bea6f8a7105ba32a635077bcd4bed56e828ae9d7998d16a43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6578696e66696e6974652f457863656c)](https://camo.githubusercontent.com/a511b380b737250bea6f8a7105ba32a635077bcd4bed56e828ae9d7998d16a43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6578696e66696e6974652f457863656c)[![GitHub](https://camo.githubusercontent.com/ae9dbf448b203dea9a5280b70fa399c791bd30a8811cf3da3a82ff7eac93a881/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6578696e66696e6974652f457863656c)](https://camo.githubusercontent.com/ae9dbf448b203dea9a5280b70fa399c791bd30a8811cf3da3a82ff7eac93a881/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6578696e66696e6974652f457863656c)

### 安裝

[](#安裝)

```
composer require exinfinite/excel
```

### 套件初始化

[](#套件初始化)

```
use Exinfinite\Excel;
$excel = new Excel();
```

### 使用方式

[](#使用方式)

```
/**
 * @param Exinfinite\Excel $excel
 * @param array $cols 每個直欄的設定及標題
 * @param array $data_array 每列資料
 * @param [type] $filename 檔名(不含副檔名)
 * @return void
 * 參數範例
 * $cols = [
        'A' => ['width' => 10, 'title' => '標題1'],
        'B' => ['width' => 25, 'title' => '標題2'],
        'C' => ['width' => 25, 'title' => '標題3'],
    ];
    $data_array = [
        ['資料1', '資料2', '資料3'],
        ['資料1', '資料2', '資料3']
    ];
 */
function excel(Exinfinite\Excel $excel, $cols = [], $data_array = [], $filename) {
    array_unshift($data_array, array_column($cols, 'title'));
    $excel->write($data_array, "A1");
    $excel->set_active_sheet(0);
    $act_sheet = $excel->objPHPExcel->getActiveSheet();
    foreach (array_combine(array_keys($cols), array_column($cols, 'width')) as $col => $w) {
        $act_sheet->getColumnDimension($col)->setWidth($w)->setAutoSize(false);
    }
    $highestCol = $act_sheet->getHighestDataColumn();
    $highestRow = $act_sheet->getHighestDataRow();
    $excel->style([
        'borders' => [
            'allborders' => [
                'style' => PHPExcel_Style_Border::BORDER_THIN,
            ],
        ],
        'alignment' => [
            'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
            'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
            'wrap' => true,
        ],
    ], "A1", "{$highestCol}{$highestRow}");
    $excel->style([
        'fill' => [
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => ['argb' => 'D1EEEE'],
        ],
    ], "A1", "{$highestCol}1");
    header("Content-Type:application/vnd.ms-excel");
    header("Content-Disposition:attachment;filename={$filename}.xls");
    header("Cache-Control:max-age=0");
    return $excel->export();
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

2020d ago

### Community

Maintainers

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

---

Top Contributors

[![exinfinite](https://avatars.githubusercontent.com/u/19932513?v=4)](https://github.com/exinfinite "exinfinite (17 commits)")

### Embed Badge

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

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

###  Alternatives

[sintret/yii2-gii-adminlte

Yii2 Generator extension for Gii plugin with adminlte and base on dynagrid. upload excel to system to with log upload

209.6k2](/packages/sintret-yii2-gii-adminlte)[padosoft/php-oara

The goal of the Open Affiliate Report Aggregator (OARA) is to develop a set of PHP classes that can download affiliate reports from a number of affiliate networks, and store the data in a common format.

1811.4k1](/packages/padosoft-php-oara)

PHPackages © 2026

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