PHPackages                             chinahub/xls-writer - 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. chinahub/xls-writer

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

chinahub/xls-writer
===================

php xls library based on xlsWriter

v1.2.2(4y ago)117MITPHPPHP &gt;=7.4

Since Apr 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chinahub/xls-writer)[ Packagist](https://packagist.org/packages/chinahub/xls-writer)[ RSS](/packages/chinahub-xls-writer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (11)Used By (0)

xls-writer
==========

[](#xls-writer)

php xls library based on xlsWriter, php-xlsWriter：

Installation
------------

[](#installation)

Run the following command to install the latest applicable version of the package:

```
composer require chinahub/xls-writer
```

Env Required
------------

[](#env-required)

- `xlswriter` extention

```
pecl install xlswriter
# add extension = xlswriter.so to php.ini

```

- recommend `PHP` &gt; 7.4

Usage
-----

[](#usage)

### Export

[](#export)

```
use Chinahub\XlsWriter\interfaces\ExportInterface;

class UserExport implements ExportInterface
{
    public function headers(): array
    {
        return ['id','name','email'];
    }

    public function data(): array
    {
        return [
            [1,'tom','test@qq.com'],
            [2,'lily','test@gmail.com'],
            [3,'lisa','test@163.com'],

        ];
    }
}
```

#### output path

[](#output-path)

```
use Chinahub\XlsWriter\Export;

$excel = new Export(new UserExport());
$excel->config = ['path' => '/www'];
$excel->fileName = 'user.xlsx';
$excel->output();
```

#### output download

[](#output-download)

```
use Chinahub\XlsWriter\Export;

$excel = new Export(new UserExport());
$excel->fileName = 'user.xlsx';
$excel->download();
```

### Import

[](#import)

get all data from sheet

```
use Chinahub\XlsWriter\Import;

$excel = new Import('/www/user.xlsx');
$excel->getSheet();
```

get row from sheet

```
use Chinahub\XlsWriter\Import;

$excel = new Import('/www/user.xlsx');
$excel = $excel->instance();
while (($row = $excel->nextRow()) !== NULL) {
    var_dump($row);
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

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

Total

9

Last Release

1492d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b2ed42d98307118d4905d78e2898bc40c55ad37f19c035697bab4b29d756ac4?d=identicon)[chinahub](/maintainers/chinahub)

### Embed Badge

![Health badge](/badges/chinahub-xls-writer/health.svg)

```
[![Health](https://phpackages.com/badges/chinahub-xls-writer/health.svg)](https://phpackages.com/packages/chinahub-xls-writer)
```

###  Alternatives

[dmind/cookieman

Provides a user consent popup. It asks for approval to include tracking objects (cookies, images or any HTML) and includes the objects when consented. It also removes cookies after the consent has been revoked.

39190.5k](/packages/dmind-cookieman)

PHPackages © 2026

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