PHPackages                             sands/laravel-presenter-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. [File &amp; Storage](/categories/file-storage)
4. /
5. sands/laravel-presenter-excel

ActiveLibrary[File &amp; Storage](/categories/file-storage)

sands/laravel-presenter-excel
=============================

Laravel Presenter plugin to respond with MS Excel files: XLSX, XLS and CSV.

1.0.0(9y ago)118MITPHP

Since Sep 11Pushed 9y ago4 watchersCompare

[ Source](https://github.com/sands-consulting/laravel-presenter-excel)[ Packagist](https://packagist.org/packages/sands/laravel-presenter-excel)[ RSS](/packages/sands-laravel-presenter-excel/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Sands\\Presenter\\Excel
=======================

[](#sandspresenterexcel)

[Sands Laravel Presenter](https://github.com/sands-consulting/laravel-presenter) plugin to respond with MS Excel files: XLSX, XLS and CSV. Files are generated using the awesome [Laravel Excel](https://github.com/Maatwebsite/Laravel-Excel) package.

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

[](#installation)

```
$ composer require sands/laravel-presenter-excel
```

Make sure [Sands\\Presenter](https://github.com/sands-consulting/laravel-presenter) has been properly installed.

In `config/app.php` add `Sands\Presenter\Excel\ExcelPresenterServiceProvider` after the `Sands\Presenter\PresenterServiceProvider` inside the `providers` array:

```
'providers' => [
     ...
     Sands\Presenter\PresenterServiceProvider::class,
     Sands\Presenter\Excel\ExcelPresenterServiceProvider::class,
     ...
]
```

Usage
-----

[](#usage)

This plugin allows you to easily create XLSX, XLS and CSV exports.

Let's say you have a UsersController with the below method:

```
public function index()
{
    return $this->present(['users' => User::all()])
        ->setOption('excel.fileName', 'User Reports')
        ->using('blade', 'xlsx', 'csv', 'xls');
}
```

When the user visits `/users?format=xlsx`, they will be prompted to download the `User Reports.xlsx` file.

When the user visits `/users?format=xls`, they will be prompted to download the `User Reports.xls` file.

When the user visits `/users?format=csv`, they will be prompted to download the `User Reports.csv` file.

### Data Format for XLSX and XLS

[](#data-format-for-xlsx-and-xls)

Data for XLSX and XLS must be a nested collection as per example below:

```
public function csvData()
{
    return [
        "Sheet 1 Name" => [
            [row 1 data],
            [row 2 data],
            ...
        ],
        ...
    ];

    ... or ...

    return [
        "Users" => User::all(),
        "Tasks" => Task::all(),
        ...
    ];
}
```

### Data Format for CSV

[](#data-format-for-csv)

Data for CSV must be as collection per example below:

```
public function csvData()
{
    return [
        [row 1 data],
        [row 2 data],
        ...
    ];

    ... or ...

    return User::all();
}
```

### File Properties

[](#file-properties)

File properties can be set using the `setOption` method. Properties available are as per [defined here](http://www.maatwebsite.nl/laravel-excel/docs/reference-guide).

The export file name can be changed via the `excel.fileName` option.

```
public function index()
{
    return $this->present()
        ->setOption('data.blade', 'bladeData')
        ->setOption('data.xlsx', 'data')
        ->setOption('excel.fileName', 'User Reports')
        ->setOption('excel.title', 'Exported User Reports')
        ->using('blade', 'xlsx');
}
```

MIT License
-----------

[](#mit-license)

Copyright (c) 2016 Sands Consulting Sdn Bhd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

3578d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/207807?v=4)[Zulfa Juniadi](/maintainers/zulfajuniadi)[@zulfajuniadi](https://github.com/zulfajuniadi)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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