Laravel EnsoLaravel Enso
Guide
Back End
Front End
GitHub
Guide
Back End
Front End
GitHub
  • Back End

    • Action Logger
    • Addresses
    • Algolia
    • Algolia Webshop
    • API
    • Audits
    • Avatars
    • Cache Chain
    • Calendar
    • Cargo Partner
    • Categories
    • Charts
    • CI/CD
    • Cli
    • CNP Validator
    • Comments
    • Commercial
    • Companies
    • Core
    • Countries
    • Currencies
    • Data Export
    • Data Import
    • Discounts
    • Documents
    • Dynamic Methods
    • EAV
    • Emag
    • Enums
    • Excel
    • Facebook
    • Files
    • Filters
    • Financials
    • Forms
    • Frisbo
    • Google
    • Helpers
    • Holidays
    • How-to
    • Image Transformer
    • Impersonate
    • Interactions
    • Inventory
    • IO
    • Localisation
    • Lockable Models
    • Logs
    • Measurement Units
    • Meili Search
    • Meili Search Webshop
    • Menus
    • Migrator
    • Monitored Emails
    • Notifications
    • Packaging Units
    • PDF
    • People
    • Permissions
    • Product Eav
    • Product Lots
    • Products
    • Questionnaires
    • Rememberable
    • Roles
    • Sale Channels
    • Searchable
    • Select
    • Sentry
    • Services
    • Smart Bill
    • Sms Advert
    • Stripe
    • Tables
    • Tasks
    • Teams
    • Ticketing
    • Track Who
    • Tutorials
    • Typesense
    • Typesense Webshop
    • Unit Conversion
    • Upgrade
    • UPS
    • User Groups
    • Users
    • Versions
    • Virtual Call Center
    • Vouchers
    • Webshop
    • Webshop Commercial

Data Import

LicenseStableDownloadsPHPIssuesMerge 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:

  • laravel-enso/core ↗
  • laravel-enso/dynamic-methods ↗
  • laravel-enso/enums ↗
  • laravel-enso/excel ↗
  • laravel-enso/files ↗
  • laravel-enso/helpers ↗
  • laravel-enso/io ↗
  • laravel-enso/migrator ↗
  • laravel-enso/select ↗
  • laravel-enso/tables ↗
  • laravel-enso/track-who ↗

Required external package:

  • openspout/openspout ↗

Companion frontend package:

  • @enso-ui/data-import ↗

Contributions

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

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

Edit this page on GitHub
Last Updated: 4/20/2026, 3:07:08 PM
Prev
Data Export
Next
Discounts