dan-delvo/excel-import-for-backpack

A Backpack CRUD operation for importing Excel and CSV files with header-to-column mapping.

Maintainers

Package info

github.com/Dan-Delvo/excel-import-for-backpack

Homepage

pkg:composer/dan-delvo/excel-import-for-backpack

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-03-11 09:24 UTC

This package is auto-updated.

Last update: 2026-03-11 12:45:41 UTC


README

Latest Version on Packagist Total Downloads The Whole Fruit Manifesto

ExcelImportForBackpack adds an import operation to Backpack for Laravel CRUD controllers.

It provides:

  • an Import button on the List operation;
  • an import screen that reads Excel or CSV headers in the browser;
  • automatic header-to-database-column mapping;
  • server-side import handling using maatwebsite/excel.

Screenshots

Screenshots can be added later. The package is fully usable without published assets.

Installation

Prerequisites:

  • PHP ZIP extension enabled (ext-zip)
  • A Backpack v7 compatible Laravel application
composer require dan-delvo/excel-import-for-backpack

The package uses Laravel auto-discovery, so no manual service provider registration is required.

If Composer reports that ext-zip is missing, enable the ZIP extension in your CLI PHP installation and run the command again.

If you want to customize the package views or config, publish them with:

php artisan vendor:publish --tag=excel-import-for-backpack

Usage

Add the import operation trait to your CRUD controller:

<?php

namespace App\Http\Controllers\Admin;

use App\Models\Product;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
use DanDelvo\ExcelImportForBackpack\Http\Controllers\Operations\ImportOperations;

class ProductCrudController extends CrudController
{
    use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
    use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
    use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
    use ImportOperations;

    public function setup()
    {
        CRUD::setModel(Product::class);
        CRUD::setRoute(config('backpack.base.route_prefix').'/product');
        CRUD::setEntityNameStrings('product', 'products');
    }
}

Once the trait is added, the package will:

  • register GET /admin/{entity}/import and POST /admin/{entity}/import routes;
  • add an Import button to the List operation;
  • render the import screen from the package views.

The import expects the first row of the file to contain headings.

Queue Behavior

The import class implements ShouldQueue and WithChunkReading.

  • If your application queue driver is sync, the import runs immediately.
  • If your application uses a real queue connection, make sure a queue worker is running.

Overwriting

Publish the package resources:

php artisan vendor:publish --tag=excel-import-for-backpack-views
php artisan vendor:publish --tag=excel-import-for-backpack-config

Published views will be placed in:

resources/views/vendor/dan-delvo/excel-import-for-backpack

You can then modify the published Blade files without changing the package source.

Change log

Changes are documented here on Github. Please see the Releases tab.

Testing

composer test

Contributing

Please see contributing.md for a todolist and howtos.

Security

If you discover any security related issues, please email dandelvo12345@gmail.com instead of using the issue tracker.

Credits

License

This project was released under MIT, so you can install it on top of any Backpack & Laravel project. Please see the license file for more information.

However, please note that you do need Backpack installed, so you need to also abide by its YUMMY License. That means in production you'll need a Backpack license code. You can get a free one for non-commercial use (or a paid one for commercial use) on backpackforlaravel.com.