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

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

laravel-enso/excel
==================

Excel for Laravel Enso

3.2.3(2mo ago)039.7k↑45%34MITPHPPHP ^8.0CI failing

Since Oct 2Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/laravel-enso/excel)[ Packagist](https://packagist.org/packages/laravel-enso/excel)[ Docs](https://github.com/laravel-enso/excel)[ RSS](/packages/laravel-enso-excel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (27)Used By (4)

Excel
=====

[](#excel)

[![License](https://camo.githubusercontent.com/e6ec681df57d97f02a1276f9c21f04be9cad71e11b294fb27680f05a363e6859/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f657863656c2f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/0a946c5ce779eff6e7a6364955f2e8e7b1b7d016a1f11180438706b2de95dced/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f657863656c2f76657273696f6e)](https://packagist.org/packages/laravel-enso/excel)[![Downloads](https://camo.githubusercontent.com/5ae2a1283d35bf4ea7630ab7859b94b69ac27fac0cfff9e8000c174de2247372/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f657863656c2f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/excel)[![PHP](https://camo.githubusercontent.com/ef6afd4ccdaa708a9b1a0a353d6d03a13ca1f03887b8db701d4118dc30a6735a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/265acfe8669c2c7d18ce776ca3d55a65ef56892478a3994739c6246201d14c1f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f657863656c2e737667)](https://github.com/laravel-enso/excel/issues)[![Merge Requests](https://camo.githubusercontent.com/16308038f3701b15f34cc11ed338b7c229a1ef467fbb6eea84b1153bff6cbecc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f657863656c2e737667)](https://github.com/laravel-enso/excel/pulls)

Description
-----------

[](#description)

Excel provides a small contract-based `.xlsx` export service for Laravel and Laravel Enso.

The package delegates spreadsheet writing to OpenSpout and keeps the exporter API intentionally simple: an exporter object declares the workbook filename, the sheet names, the heading row for each sheet, and the data rows for each sheet.

It is used in Enso to generate downloadable or persisted Excel files from domain-specific exporter classes without coupling those exporters to a concrete writer implementation.

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

[](#installation)

Install the package:

```
composer require laravel-enso/excel
```

The package does not require service provider registration.

To use it, create a class that implements `LaravelEnso\Excel\Contracts\ExportsExcel`, then pass that exporter to `LaravelEnso\Excel\Services\ExcelExport`.

If you want the generated file saved under a custom storage folder, also implement `LaravelEnso\Excel\Contracts\SavesToDisk`.

Features
--------

[](#features)

- Exports `.xlsx` files through OpenSpout.
- Supports multi-sheet workbooks.
- Uses a small `ExportsExcel` contract for exporter classes.
- Can stream files inline as downloads.
- Can save files to disk and return their storage path.
- Supports custom storage folders through `SavesToDisk`.

Usage
-----

[](#usage)

Define an exporter:

```
use LaravelEnso\Excel\Contracts\ExportsExcel;

class ContractorStock implements ExportsExcel
{
    public function filename(): string
    {
        return 'stock_report.xlsx';
    }

    public function heading(string $sheet): array
    {
        return match ($sheet) {
            'stock' => ['Product', 'Quantity'],
            'history' => ['Date', 'Product', 'Quantity'],
        };
    }

    public function rows(string $sheet): array
    {
        return match ($sheet) {
            'stock' => [['Panel', 12]],
            'history' => [['2026-04-18', 'Panel', 12]],
        };
    }

    public function sheets(): array
    {
        return ['stock', 'history'];
    }
}
```

Stream the export to the browser:

```
use LaravelEnso\Excel\Services\ExcelExport;

return (new ExcelExport(new ContractorStock()))->inline();
```

Save it to disk:

```
$path = (new ExcelExport(new ContractorStock()))->save();
```

Use a custom folder by implementing `SavesToDisk`:

```
use LaravelEnso\Excel\Contracts\ExportsExcel;
use LaravelEnso\Excel\Contracts\SavesToDisk;

class OrderExport implements ExportsExcel, SavesToDisk
{
    public function folder(): string
    {
        return 'exports/orders';
    }
}
```

::: warning Note Every sheet name returned by `sheets()` must have a matching `heading()` and `rows()` implementation.

When the exporter does not implement `SavesToDisk`, files are written under the default `temp` storage folder. :::

API
---

[](#api)

### Exporter Contracts

[](#exporter-contracts)

- `LaravelEnso\Excel\Contracts\ExportsExcel`
- `LaravelEnso\Excel\Contracts\SavesToDisk`

`ExportsExcel` requires:

- `filename(): string`
- `heading(string $sheet): array`
- `rows(string $sheet): array`
- `sheets(): array`

`SavesToDisk` adds:

- `folder(): string`

### Export Service

[](#export-service)

`LaravelEnso\Excel\Services\ExcelExport`

Public methods:

- `__construct(ExportsExcel $exporter)`
- `inline(): BinaryFileResponse`
- `save(): string`

Behavior:

- creates the workbook on disk first
- writes one worksheet per value returned by `sheets()`
- writes the heading row first, then all data rows
- downloads and deletes the file after send when using `inline()`

### Exception

[](#exception)

`LaravelEnso\Excel\Exceptions\ExcelExport`

Currently exposes:

- `missingInterface()`

Depends On
----------

[](#depends-on)

Framework dependency:

- [`laravel/framework`](https://github.com/laravel/framework) [↗](https://github.com/laravel/framework)

External dependency:

- [`openspout/openspout`](https://github.com/openspout/openspout) [↗](https://github.com/openspout/openspout)

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance86

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 53.7% 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 ~114 days

Recently: every ~358 days

Total

22

Last Release

74d ago

Major Versions

1.1.2 → 2.0.02020-06-25

2.0.1 → 3.0.02020-11-18

PHP version history (5 changes)1.0.0PHP &gt;=7.2.21

1.0.3PHP &gt;=7.3.0

1.1.0PHP &gt;=7.4

3.1.4PHP &gt;=8.0

3.2.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (22 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (10 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (5 commits)")[![AbdullahiAbdulkabir](https://avatars.githubusercontent.com/u/33360580?v=4)](https://github.com/AbdullahiAbdulkabir "AbdullahiAbdulkabir (2 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

ensoexcelfilegenerationlaravellaravel-ensosheetlaravelexcellaravel-enso

### Embed Badge

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

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k27.0M52](/packages/rap2hpoutre-fast-excel)[yajra/laravel-datatables-export

Laravel DataTables Queued Export Plugin.

362.2M4](/packages/yajra-laravel-datatables-export)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[bfinlay/laravel-excel-seeder

Seed the database with Laravel using Excel, XLSX, XLS, CSV, ODS, Gnumeric, XML, HTML, SLK files

3946.9k](/packages/bfinlay-laravel-excel-seeder)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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