PHPackages                             zsardarov/php-excel-exporter - 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. zsardarov/php-excel-exporter

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

zsardarov/php-excel-exporter
============================

A library that provides a way to easily export report data to excel

v1.0.1(5y ago)6488MITPHP

Since Sep 8Pushed 5y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

PHP Excel Exporter
==================

[](#php-excel-exporter)

A package for exporting your reports from Database (or any other source) to Excel (.xlsx).

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

[](#installation)

Install this package via Composer:

```
$ composer require zsardarov/php-excel-exporter
```

Basic Usage
-----------

[](#basic-usage)

Firstly create the factory. Pass the heading row and exportable data to it. After all the response can be sent to client. Example:

```
use Zsardarov\ExcelExporter\ExcelResponseFactory;

$heading = ['id', 'title', 'content'];
$exportable = [
    [1, 'Lorem', 'ipsum'],
    [2, 'Sample', 'data']
];

$factory = new ExcelResponseFactory();

return $factory->setHeadingRow($heading)
     ->createFrom($exportable)
     ->send();
```

Custom Factories
----------------

[](#custom-factories)

Also, you may extend basic functionality by creating custom factories. For this purpose you must inherit your factory from `BaseExcelFactory class`. Example:

```
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
use Box\Spout\Writer\XLSX\Writer;
use Zsardarov\ExcelExporter\BaseExcelResponseFactory;

class CustomExcelResponseFactory extends BaseExcelResponseFactory
{
    protected function getHeadingRow(): ?array
    {
        return [
            'id',
            'category',
            'value',
            'date'
        ];
    }

    protected function contentWriter(Writer $writer, iterable $exportable): void
    {
        foreach ($exportable as $item) {
            $cells = [
                $item->id,
                $item->category,
                $item->value,
                $item->date
            ];

            $row = WriterEntityFactory::createRowFromArray($cells);
            $writer->addRow($row);
        }
    }
}
```

```
use App\Models\Report;
use App\Services\CustomExcelResponseFactory;

class SampleController extends Controller
{
    public function export()
    {
        $exportable = Report::all();
        $factory = new CustomExcelResponseFactory();

        return $factory->createFrom($exportable, 'report.xlsx');
    }
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Every ~0 days

Total

2

Last Release

2067d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a7f654236a28d7868a2c1fcc417462a3e237daf21160c88a6e1e41e7e278a95?d=identicon)[zsardarov](/maintainers/zsardarov)

---

Top Contributors

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

---

Tags

excelphpphpexcel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zsardarov-php-excel-exporter/health.svg)

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

###  Alternatives

[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M128](/packages/openspout-openspout)

PHPackages © 2026

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