PHPackages                             thomascombe/backpack-async-export - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. thomascombe/backpack-async-export

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

thomascombe/backpack-async-export
=================================

This is a package to manage async export in Backpack for Laravel

5.0.0(2w ago)1530.9k↓45.5%6[2 issues](https://github.com/thomascombe/backpack-async-export/issues)MITPHPPHP ^8.2CI failing

Since Apr 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/thomascombe/backpack-async-export)[ Packagist](https://packagist.org/packages/thomascombe/backpack-async-export)[ Docs](https://github.com/thomascombe/backpack_async_export)[ GitHub Sponsors](https://github.com/thomascombe)[ RSS](/packages/thomascombe-backpack-async-export/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (24)Versions (31)Used By (0)

[![Social Card of Laravel Backpack Async Export](/docs/images/banner.png)](/docs/images/banner.png)

Laravel Backpack Async Export
=============================

[](#laravel-backpack-async-export)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b8a565ffc3423551042e8e4a58c5ea3aa6451db3b9d6e35fccf4b7c48073b7c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74686f6d6173636f6d62652f6261636b7061636b2d6173796e632d6578706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thomascombe/backpack-async-export)[![PHPCS check](https://github.com/thomascombe/backpack-async-export/actions/workflows/phpcs.yml/badge.svg)](https://github.com/thomascombe/backpack-async-export/actions/workflows/phpcs.yml)[![Total Downloads](https://camo.githubusercontent.com/314e7f6ca725037150f7d71b07e40204dc8a88e156a754ecb2c584a23b3b314a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74686f6d6173636f6d62652f6261636b7061636b2d6173796e632d6578706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thomascombe/backpack-async-export)

This is a package to manage async export and import in [Backpack](https://backpackforlaravel.com/) for Laravel

[![Demo of Laravel Backpack Async Export](/docs/images/demo.png)](/docs/images/demo.png)

[![Demo of Laravel Backpack Async Export](/docs/images/demo_ended.png)](/docs/images/demo_ended.png)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require thomascombe/backpack-async-export
```

VersionPHPLaravelBackpack1.x7.4 - ^8.0^8.0 - ^9.0 - ^10.04.1.\* - ~5.02.x^8.1^9.0 - ^10.0~5.5 - ~6.03.x^8.1^10.0~6.04.x^8.2^11.0~6.05.x^8.2^12.0 - ^13.0^7.0You can publish and run the migrations with:

```
php artisan vendor:publish --provider="Thomascombe\BackpackAsyncExport\BackpackAsyncExportServiceProvider" --tag="backpack-async-export-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Thomascombe\BackpackAsyncExport\BackpackAsyncExportServiceProvider" --tag="backpack-async-export-config"
```

This is the contents of the published config file:

```
return [
    'feature_enabled' => [
        'export' => true,
        'import' => true,
    ],
    'user_model' => 'App\Models\User',
    'import_export_model' => Thomascombe\BackpackAsyncExport\Models\ImportExport::class,
    'admin_export_route' => 'export',
    'admin_import_route' => 'import',
    'export_memory_limit' => '2048M',
    'disk' => 'local',
];
```

Usage for export
----------------

[](#usage-for-export)

### Add export item in menu

[](#add-export-item-in-menu)

```
php artisan backpack:add-sidebar-content " Export"
# or
php artisan backpack:add-menu-content ""
```

### Create you export class

[](#create-you-export-class)

```
php artisan make:export UserExport --model=App/Models/User
```

For all details, have a look at [Laravel Excel Package](https://laravel-excel.com/).

You can make your export class extends our [LaravelExcel](./src/Exports/LaravelExcel.php) abstract.

### Create your controller

[](#create-your-controller)

```
php artisan backpack:crud {ModelName}
```

### Your controller need to implement interface

[](#your-controller-need-to-implement-interface)

```
use Thomascombe\BackpackAsyncExport\Http\Controllers\Admin\Interfaces\ExportableCrud;

class {Name}CrudController extends CrudController implements ExportableCrud {}
```

### Use awesome trait

[](#use-awesome-trait)

```
use \Thomascombe\BackpackAsyncExport\Http\Controllers\Admin\Traits\HasExportButton;
```

### Call method to add buttons

[](#call-method-to-add-buttons)

```
public function setup()
{
    // ...
    $this->addExportButtons();
}
```

### Add method to your CRUD controller

[](#add-method-to-your-crud-controller)

```
use Thomascombe\BackpackAsyncExport\Enums\ActionType;
use Thomascombe\BackpackAsyncExport\Enums\ImportExportStatus;
use Thomascombe\BackpackAsyncExport\Models\ImportExport;

public function getExport(): ImportExport
{
    return ImportExport::create([
        ImportExport::COLUMN_USER_ID => backpack_user()->id,
        ImportExport::COLUMN_ACTION_TYPE => ActionType::Export,
        ImportExport::COLUMN_STATUS => ImportExportStatus::Created,
        ImportExport::COLUMN_FILENAME => sprintf('export/users_%s.xlsx', now()->toIso8601String()),
        ImportExport::COLUMN_EXPORT_TYPE => UserExport::class,
    ]);
}

public function getExportParameters(): array
{
    return [];
}
```

### Simple csv export

[](#simple-csv-export)

It may sometimes be necessary to export large amounts of data. PhpSpreadsheet (used behind the hood by this package) does not always offer the best performance. In this case, it is recommended to use the low-level functions of PHP, such as [fputcsv](https://www.php.net/manual/function.fputcsv.php).

This package has an abstract class [SimpleCsv](./src/Exports/SimpleCsv.php) which can be extended to use this export mode. Of course, it is more limited and only allows you to define a query, headers and a mapping between the model and the data table to be exported.

```
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Thomascombe\BackpackAsyncExport\Exports\SimpleCsv;

class UserExport extends SimpleCsv
{
    public function query(): EloquentBuilder
    {
        return User::query();
    }

    public function headings(): array
    {
        return [
            'ID',
            'Name',
            'Email',
        ];
    }

    /**
     * @param User $user
     * @return array
     */
    public function map($user): array
    {
        return [
            $user->id,
            $user->name,
            $user->email,
        ];
    }
}
```

Usage for import
----------------

[](#usage-for-import)

### Add import item in menu

[](#add-import-item-in-menu)

```
php artisan backpack:add-sidebar-content " Import"
```

### Create you import class

[](#create-you-import-class)

```
php artisan make:import UserImport --model=App/Models/User
```

For all details, have a look at [Laravel Excel Package](https://laravel-excel.com/)

### Create your controller

[](#create-your-controller-1)

```
php artisan backpack:crud {Name}CrudController
```

### Your controller need to implement interface

[](#your-controller-need-to-implement-interface-1)

```
use Thomascombe\BackpackAsyncExport\Http\Controllers\Admin\Interfaces\ImportableCrud;

class {Name}CrudController extends CrudController implements ImportableCrud {}
```

### Use awesome trait

[](#use-awesome-trait-1)

```
use Thomascombe\BackpackAsyncExport\Http\Controllers\Admin\Traits\HasImportButton;
```

### Call method to add buttons

[](#call-method-to-add-buttons-1)

```
public function setup()
{
    // ...
    $this->addImportButtons();
}
```

### Add method to your CRUD controller

[](#add-method-to-your-crud-controller-1)

```
use Thomascombe\BackpackAsyncExport\Enums\ActionType;
use Thomascombe\BackpackAsyncExport\Enums\ImportExportStatus;
use Thomascombe\BackpackAsyncExport\Models\ImportExport;

public function getImport(): ImportExport
{
    return ImportExport::create([
        ImportExport::COLUMN_USER_ID => backpack_user()->id,
        ImportExport::COLUMN_ACTION_TYPE => ActionType::Import->value,
        ImportExport::COLUMN_STATUS => ImportExportStatus::Created,
        ImportExport::COLUMN_FILENAME => '',
        ImportExport::COLUMN_EXPORT_TYPE => UserImport::class,
    ]);
}

public function getImportParameters(): array
{
    return [
        'private' => [
            'hint' => 'CSV file required',
            'mimetypes' => ['text/csv', 'application/csv'],
        ],
    ];
}
```

Need more?
----------

[](#need-more)

### Override ImportExport model

[](#override-importexport-model)

You can override `ImportExport` model using config : `import_export_model`.
Your model class **need** to implement `\Thomascombe\BackpackAsyncExport\Models\ImportExport`.

```
class ImportExport extends \Thomascombe\BackpackAsyncExport\Models\ImportExport
{
}
```

### Update export name

[](#update-export-name)

Package allow to change export name with interface on your export class: `Thomascombe\BackpackAsyncExport\Exports\ExportWithName`

```
namespace App\Exports;

use Thomascombe\BackpackAsyncExport\Exports\ExportWithName;

class UserExport implements ExportWithName
{
    public static function getName(): string
    {
        return 'My export name';
    }
}
```

[![Demo with custom name of Laravel Backpack Async Export](/docs/images/demo_name.png)](/docs/images/demo_name.png)

### Multi export by CRUD?

[](#multi-export-by-crud)

You can easily have multi export on save CRUD.
Your CRUD controller need to implement `Thomascombe\BackpackAsyncExport\Http\Controllers\Admin\Interfaces\MultiExportableCrud` interface.

```
public function getAvailableExports(): array
{
    return [
        'default' => null,
        'all' => 'All',
    ];
}
```

**Array keys**: key for query params and dynamic method name
**Array values**: Export name (display in CRUD button)

For each new export you have to add news methods:

```
public function getExport*All*(): ImportExport
{
    return ImportExport::create(...);
}

public function getExport*All*Parameters(): array
{
    return [...];
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [thomascombe](https://github.com/thomascombe)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance67

Regular maintenance activity

Popularity38

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 95.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~81 days

Recently: every ~141 days

Total

24

Last Release

17d ago

Major Versions

0.1 → 1.0.02022-06-22

1.3.1 → 2.0.02023-03-20

2.1.0 → 3.0.02023-11-03

3.0.0 → 4.0.02024-07-16

4.2.0 → 5.0.02026-06-15

PHP version history (3 changes)0.1PHP ^7.4|^8.0

2.0.0PHP ^8.1

4.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39582382?v=4)[Thomas Combe](/maintainers/thomascombe)[@thomascombe](https://github.com/thomascombe)

---

Top Contributors

[![thomascombe](https://avatars.githubusercontent.com/u/39582382?v=4)](https://github.com/thomascombe "thomascombe (97 commits)")[![jargoud](https://avatars.githubusercontent.com/u/3224065?v=4)](https://github.com/jargoud "jargoud (3 commits)")[![WilliamSauvan](https://avatars.githubusercontent.com/u/7406126?v=4)](https://github.com/WilliamSauvan "WilliamSauvan (2 commits)")

---

Tags

laravelexportbackpackthomascombebackpack-async-export

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/thomascombe-backpack-async-export/health.svg)

```
[![Health](https://phpackages.com/badges/thomascombe-backpack-async-export/health.svg)](https://phpackages.com/packages/thomascombe-backpack-async-export)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[tapp/filament-form-builder

User facing form builder using Filament components

132.4k3](/packages/tapp-filament-form-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
