laravel-enso/dataexport

This package is abandoned and no longer maintained. The author suggests using the laravel-enso/data-export package instead.

Structure for holding Laravel-Enso exports

Maintainers

Package info

github.com/laravel-enso/data-export

pkg:composer/laravel-enso/dataexport

Statistics

Installs: 7 832

Dependents: 1

Suggesters: 0

Stars: 2

Open Issues: 2


README

License Stable Downloads PHP Issues Merge Requests

Description

Data Export adds tracked XLSX export generation to Enso.

The package stores export state and progress, attaches the generated file to the Enso files system, supports both asynchronous query-based exports and synchronous in-memory exporters, and notifies users when the export finishes or fails.

It is designed for backoffice flows where long-running exports should be observable, cancellable, and retained for a configurable period.

Installation

Install the package:

composer require laravel-enso/data-export

Run the package migrations:

php artisan migrate

Optional publishes:

php artisan vendor:publish --tag=data-export-config
php artisan vendor:publish --tag=data-export-mail

Default configuration:

return [
    'rowLimit' => env('EXPORT_ROW_LIMIT', 1000000),
    'retainFor' => (int) env('EXPORT_RETAIN_FOR', 60),
];

The package schedules enso:data-export:purge daily.

Features

  • Asynchronous XLSX exports based on a query builder.
  • Synchronous export support for classic Enso Excel exporters.
  • Export progress tracking and IO broadcasting support.
  • File attachment and cleanup integration through laravel-enso/files.
  • Hooks for setup, teardown, custom notifications, custom row actions, and custom sheet names.
  • Cancel endpoint and automatic retention purge.

Usage

Implement the asynchronous exporter contract:

use Illuminate\Database\Eloquent\Builder;
use LaravelEnso\DataExport\Contracts\ExportsExcel;

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

    public function heading(): array
    {
        return ['Id', 'Number'];
    }

    public function query(): Builder
    {
        return Order::query();
    }

    public function attributes(): array
    {
        return ['id', 'number'];
    }

    public function mapping($row): array
    {
        return [$row->id, $row->number];
    }
}

Dispatch the export through the model:

use LaravelEnso\DataExport\Models\Export;

Export::excel(new OrdersExport());

API

HTTP routes

  • PATCH api/export/{export}/cancel

Route name:

  • export.cancel

Artisan commands

  • enso:data-export:purge

Extension points

  • BeforeHook
  • AfterHook
  • CustomCount
  • CustomMax
  • CustomMin
  • CustomRowAction
  • CustomSheetName
  • Notifies

Depends On

Required Enso packages:

Optional Enso companion package:

Required external package:

Contributions

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

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