Download the PHP package laravel-enso/excel without Composer
On this page you can find all versions of the php package laravel-enso/excel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-enso/excel
More information about laravel-enso/excel
Files in laravel-enso/excel
Package excel
Short Description Excel for Laravel Enso
License MIT
Homepage https://github.com/laravel-enso/excel
Informations about the package excel
Excel
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
Install the package:
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
- Exports
.xlsxfiles through OpenSpout. - Supports multi-sheet workbooks.
- Uses a small
ExportsExcelcontract 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
Define an exporter:
Stream the export to the browser:
Save it to disk:
Use a custom folder by implementing SavesToDisk:
::: 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
Exporter Contracts
LaravelEnso\Excel\Contracts\ExportsExcelLaravelEnso\Excel\Contracts\SavesToDisk
ExportsExcel requires:
filename(): stringheading(string $sheet): arrayrows(string $sheet): arraysheets(): array
SavesToDisk adds:
folder(): string
Export Service
LaravelEnso\Excel\Services\ExcelExport
Public methods:
__construct(ExportsExcel $exporter)inline(): BinaryFileResponsesave(): 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
LaravelEnso\Excel\Exceptions\ExcelExport
Currently exposes:
missingInterface()
Depends On
Framework dependency:
External dependency:
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!
All versions of excel with dependencies
openspout/openspout Version ^4.0
php Version ^8.0