Excel
Excel utility package for Laravel Enso
This package can work independently of the Enso ecosystem.
For live examples and demos, you may visit laravel-enso.com
Installation
install using composer: composer require laravel-enso/excel
Features
- is a small wrapper that uses box/spout under the hood
- utilizes two contracts for which require specific methods to be available on the specific Excel file generator
ExportsExcel
SavesToDisk
- the
ExcelExport
service requires an excel generator parameter that must implement at least theExportsExcel
contract and optionally theSavesToDisk
contract - can provide the generated excel document inline (for downloads) or save the file to disk
Usage
In order to generate an Excel, you need to create a generator class that implements the ExcelExport
contract. Then you must instantiate an ExcelExport
class, passing your generator as a constructor parameter,
and finally call the inline
method:
$excel = new MyExcelExporter();
(new ExcelExport($excel))->inline();
If you want to have the excel file saved to disk, have your generator also implement the SavesToDisk
contract, and instead of calling the inline()
method, call the save()
method on your
ExcelExport
instance:
$excel = new MyExcelExporter();
(new ExcelExport($excel))->save();
External dependencies
Contributions
are welcome. Pull requests are great, but issues are good too.
License
This package is released under the MIT license.