1. Go to this page and download the library: Download laravel-enso/excel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laravel-enso / excel example snippets
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'];
}
}
use LaravelEnso\Excel\Services\ExcelExport;
return (new ExcelExport(new ContractorStock()))->inline();
$path = (new ExcelExport(new ContractorStock()))->save();
use LaravelEnso\Excel\Contracts\ExportsExcel;
use LaravelEnso\Excel\Contracts\SavesToDisk;
class OrderExport implements ExportsExcel, SavesToDisk
{
public function folder(): string
{
return 'exports/orders';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.