laravel-enso/data-import

Excel Importer dependency for Laravel Enso

Maintainers

Package info

github.com/laravel-enso/data-import

pkg:composer/laravel-enso/data-import

Statistics

Installs: 42 814

Dependents: 4

Suggesters: 0

Stars: 20

Open Issues: 1

6.10.7 2026-04-21 15:17 UTC

This package is auto-updated.

Last update: 2026-04-21 15:24:47 UTC


README

License Stable Downloads PHP Issues Merge Requests

Description

Data Import adds template-driven spreadsheet imports to Enso.

The package validates uploaded files against JSON template definitions, splits work into queued jobs, tracks import progress and status, generates rejected-row workbooks when needed, and exposes the API endpoints required by the Enso import UI.

It supports multi-sheet XLSX imports as well as CSV and TXT imports, with configurable structure validation, queue separation, and retention policies.

Installation

Install the package:

composer require laravel-enso/data-import

Run the package migrations:

php artisan migrate

Optional publishes:

php artisan vendor:publish --tag=data-import-config
php artisan vendor:publish --tag=data-import-factory
php artisan vendor:publish --tag=data-import-mail
php artisan vendor:publish --tag=data-import-examples

Register at least one import type in config/enso/imports.php:

'configs' => [
    'userGroups' => [
        'label' => 'User Groups',
        'template' => 'app/Imports/Templates/userGroups.json',
    ],
],

The package schedules these maintenance commands daily:

  • enso:data-import:purge
  • enso:data-import:cancel-stuck

Features

  • Template-driven import definitions using JSON files.
  • Queue-based splitting and processing for large imports.
  • Support for xlsx, csv, and txt uploads.
  • Strict or flexible structure validation.
  • Rejected-row report generation with an extra errors column.
  • Downloadable import templates generated from the JSON definition.

Usage

Create an importer class that implements the package contract:

use LaravelEnso\DataImport\Contracts\Importable;
use LaravelEnso\DataImport\Models\Import;
use LaravelEnso\Helpers\Services\Obj;

class UserGroupImporter implements Importable
{
    public function run(Obj $row, Import $import)
    {
        UserGroup::create($row->all());
    }
}

Point a template configuration entry to a JSON template that defines sheets, columns, and the importer class. The package can then:

  • serve the generated template workbook
  • validate uploaded files against the template
  • queue the import when the structure is valid

API

HTTP routes

  • POST api/import/store
  • DELETE api/import/{import}
  • GET api/import/download/{import}
  • GET api/import/initTable
  • GET api/import/tableData
  • GET api/import/exportExcel
  • PATCH api/import/{import}/cancel
  • PATCH api/import/{import}/restart
  • GET api/import/options
  • GET api/import/{type}
  • GET api/import/{type}/template
  • GET api/import/{rejected}/rejected

Artisan commands

  • enso:data-import:purge
  • enso:data-import:cancel-stuck

Extension points

  • Importable
  • BeforeHook
  • AfterHook
  • Authenticates
  • Authorizes

Depends On

Required Enso packages:

Required external package:

Companion frontend package:

Contributions

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

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