PHPackages                             kriss/data-export - 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. kriss/data-export

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

kriss/data-export
=================

Data Export For PHP

v2.1.0(1y ago)21.6kMITPHPPHP ^8.1CI passing

Since Jan 12Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/krissss/php-data-exporter)[ Packagist](https://packagist.org/packages/kriss/data-export)[ Docs](https://github.com/krissss/php-data-export)[ RSS](/packages/kriss-data-export/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (20)Used By (0)

Data Export For PHP
===================

[](#data-export-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9312231e841cf1db9f5c3c5093a190547c67e575112a2f5583afcdf54b3a883a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b726973732f646174612d6578706f72743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kriss/data-export)[![Tests](https://github.com/krissss/php-data-exporter/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/krissss/php-data-exporter/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/856d65229c1dc64fb1096b7611512794b93b998d32f080c924217fb443bd45e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b726973732f646174612d6578706f72743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kriss/data-export)

Wrap [sonata-project/exporter](https://github.com/sonata-project/exporter), make it easy and strong~

Feature
-------

[](#feature)

- Simple api (use `DataExporter::csv()->saveAs()`)
- Quick change for different output type (csv/xlsx/xls/ods...)
- Support a lot of source, and can use array or iterator quickly
- Low memory usage with huge data write (use csv/xlsxSpout)
- Low memory usage with chunk data fetch and write by chain (use GeneratorChainSourceIterator)
- Support `saveAs()` and `browserDownload()`
- Support do something in writing (use ObjectEvent)
- Support control Spreadsheet and Spout Instance, for change style and others (use Extend)
- Support Excel multi sheet write (use ExcelSheetSourceIterator)
- Support Dynamic source (use CallableSourceIterator)

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

[](#installation)

You can install the package via composer:

```
composer require kriss/data-export
```

Usage
-----

[](#usage)

### simple Example

[](#simple-example)

```
use \Kriss\DataExporter\DataExporter;

$source = [
    ['aaa', 'bbb', 'ccc'],
    ['aaa', 'bbb', 'ccc'],
    ['aaa', 'bbb', 'ccc'],
];
DataExporter::csv($source, ['showHeaders' => false])->saveAs();
```

### Support Source

[](#support-source)

- all source defined in [sonata-project/exporter](https://docs.sonata-project.org/projects/exporter/en/2.x/reference/sources/)
- Simple source, Example in [Tests](./tests/Feature/SourceTest.php)
- GeneratorChainSourceIterator, Example in [Tests](./tests/Feature/GeneratorChainSourceIteratorTest.php)
- ExcelSheetSourceIterator, Example in [Tests](./tests/Feature/ExcelSheetSourceIteratorTest.php)
- CallableSourceIterator, Example in [Tests](./tests/Feature/CallableSourceIteratorTest.php)

### Support Writer

[](#support-writer)

All Config in `DataExporter::writerConfig()`, see [Tests](./tests/Feature/WriterTest.php)

You can extend DataExporter and add Yours, see Example in [Tests](./tests/Feature/ExtraWriter.php)

FAQ
---

[](#faq)

> Why [box/spout](https://github.com/box/spout) Use

`box/spout` can write xlsx use stream, but `phpoffice/phpspreadsheet` not. `phpoffice/phpspreadsheet` use lots of memory when write huge data, but `box/spout` use few!

> When use `GeneratorChainSourceIterator`

When you should handle huge source and need to merge them in one write.

> How to build style

Use extension, see [ExtendSpoutTest](./tests/Feature/ExtensionSpoutTest.php) or [ExtendSpreadsheetTest](./tests/Feature/ExtensionSpreadsheetTest.php)

> How to write multi sheet

Use ExcelSheetSpreadsheetTrait, see [ExcelSheetSourceIteratorTest](./tests/Feature/ExcelSheetSourceIteratorTest.php)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance51

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 73.6% 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 ~76 days

Total

19

Last Release

216d ago

Major Versions

v1.5.0 → v2.0.02024-03-11

v1.7.0 → v2.1.02024-08-13

PHP version history (3 changes)v1.0PHP ^7.3|^8.0

v2.0.0PHP ^8.1

v1.6.0PHP ^7.3

### Community

Maintainers

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

---

Top Contributors

[![krissss](https://avatars.githubusercontent.com/u/10680903?v=4)](https://github.com/krissss "krissss (64 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (12 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")

---

Tags

csvwriterodswriterphpxlsxwriterdata-exportkriss

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kriss-data-export/health.svg)

```
[![Health](https://phpackages.com/badges/kriss-data-export/health.svg)](https://phpackages.com/packages/kriss-data-export)
```

###  Alternatives

[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[numero2/contao-storelocator

Contao Plugin for managing stores (or in common address data) and providing a frontend-search based on geo data

121.5k](/packages/numero2-contao-storelocator)

PHPackages © 2026

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