PHPackages                             dimer47/backpack-server-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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. dimer47/backpack-server-export

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

dimer47/backpack-server-export
==============================

Server-side full export for Backpack CRUD with active filters, async support via queue jobs.

1.0.0(2mo ago)02MITPHPPHP ^8.2

Since May 25Pushed 2mo agoCompare

[ Source](https://github.com/dimer47/backpack-server-export)[ Packagist](https://packagist.org/packages/dimer47/backpack-server-export)[ RSS](/packages/dimer47-backpack-server-export/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

📦 Backpack Server Export
========================

[](#-backpack-server-export)

[![PHP](https://camo.githubusercontent.com/6caa15003495643be73f70c6033009042189b7d38acf492a3d5fd04ffbb45059/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/6caa15003495643be73f70c6033009042189b7d38acf492a3d5fd04ffbb45059/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Laravel](https://camo.githubusercontent.com/c62d4298b8493da83d348941b2d8ccf46293a23b8a734585cf67bff82cc9461a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322532422d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/c62d4298b8493da83d348941b2d8ccf46293a23b8a734585cf67bff82cc9461a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322532422d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465) [![Backpack](https://camo.githubusercontent.com/e1db43efedb212ff7ce4aa92dc2fce5a5410f3cdf3aa76137bf5a971b386b489/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4261636b7061636b2d36253230253743253230372d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e1db43efedb212ff7ce4aa92dc2fce5a5410f3cdf3aa76137bf5a971b386b489/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4261636b7061636b2d36253230253743253230372d626c75653f7374796c653d666c61742d737175617265) [![License](https://camo.githubusercontent.com/152aa2a37725b9fd554b28ff24d270f6071c67927a63e6d635a55c8e188e20c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/152aa2a37725b9fd554b28ff24d270f6071c67927a63e6d635a55c8e188e20c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e3f7374796c653d666c61742d737175617265)

> Server-side full export for [Backpack for Laravel](https://backpackforlaravel.com/) CRUD panels with active filters, search, sort, and async queue support.

Unlike the built-in DataTables client-side export (which only exports the **current page**), this package exports **all data** server-side, respecting the active filters, search term, column sort, and column visibility.

🎉 Features
----------

[](#-features)

- 📊 **Full server-side export** — all rows, not just the current page
- 🔍 **Filter-aware** — respects active Backpack filters, search term, and sort order
- 👁️ **ColVis-aware** — only exports columns visible to the user (respects the column visibility picker)
- 🔐 **Permission-aware** — respects per-user column visibility and query scoping
- ⚡ **Sync + Async** — direct download for small datasets, queue job for large ones
- 📝 **3 formats** — XLSX (Excel), CSV, Markdown (GFM tables)
- 🔌 **Pluggable progress tracker** — bring your own background task system or use the built-in no-op tracker
- 🧩 **One-line integration** — just `use ServerExportOperation;` in your CRUD controller
- 🌐 **Translated** — English and French included, easily extendable
- 🎨 **Native UI** — button integrates seamlessly into the DataTables export bar

📍 Installation
--------------

[](#-installation)

```
composer require dimer47/backpack-server-export
```

For XLSX support, also install PhpSpreadsheet:

```
composer require phpoffice/phpspreadsheet
```

> Without PhpSpreadsheet, only CSV and Markdown formats are available.

🚀 Quick Start
-------------

[](#-quick-start)

Add the trait to any Backpack CRUD controller:

```
use Dimer47\BackpackServerExport\Operation\ServerExportOperation;

class ArticleCrudController extends CrudController
{
    use ListOperation;
    use ServerExportOperation; // That's it!
    // ...
}
```

A **"Full Export"** dropdown button will appear in the DataTables toolbar with XLSX, CSV, and Markdown options:

```
[ Export current view ▾ ]  [ Full Export ▾ ]  [ Column visibility ▾ ]
                            ├─ Excel (XLSX)
                            ├─ CSV
                            └─ Markdown

```

⚙️ Configuration
----------------

[](#️-configuration)

Publish the config file:

```
php artisan vendor:publish --tag=backpack-server-export-config
```

```
// config/backpack-server-export.php
return [
    // Rows threshold above which export switches to async (queue job)
    // 0 = always async, null = always sync
    'async_threshold' => 1000,

    // Available export formats
    'default_formats' => ['xlsx', 'csv', 'md'],

    // Queue name for async exports
    'queue' => 'default',

    // Temporary file storage path
    'storage_path' => storage_path('app/tmp'),

    // Chunk size for async processing
    'chunk_size' => 500,

    // How long to keep generated files (minutes)
    'file_retention_minutes' => 60,
];
```

🔧 Customization
---------------

[](#-customization)

Override these methods in your CRUD controller to customize the behavior:

```
class ArticleCrudController extends CrudController
{
    use ServerExportOperation;

    // Custom export columns (default: auto-resolved from CRUD list columns)
    protected function getServerExportColumns(): ?array
    {
        return [
            ExportColumn::make('title')->withLabel('Title'),
            ExportColumn::make('author')->withLabel('Author')->withRelation('author', 'name'),
            ExportColumn::make('status')->withLabel('Status'),
        ];
    }

    // Available formats (default: from config)
    protected function getServerExportFormats(): array
    {
        return ['xlsx', 'csv'];
    }

    // Async threshold (default: from config)
    protected function getServerExportAsyncThreshold(): ?int
    {
        return 500; // force async above 500 rows
    }

    // Custom filename
    protected function getServerExportFilename(string $format): string
    {
        return 'my-articles-' . now()->format('Y-m-d');
    }
}
```

📊 Supported Column Types
------------------------

[](#-supported-column-types)

The package automatically resolves values for all standard Backpack column types:

TypeResolution`text`, `textarea`, `email`, `url`, `phone`Direct attribute value`number`Formatted with `decimals`, `dec_point`, `thousands_sep`, `prefix`, `suffix``date`, `datetime`Formatted with configurable format string`relationship`, `select`, `select_multiple`Resolved via Eloquent relation + attribute`enum`Mapped via `options` array, HTML stripped`select_from_array`Mapped via `options` array`closure`Closure executed, HTML stripped`custom_html``value()` executed, HTML stripped`boolean`, `check`Translated "Yes" / "No"`model_function`Method executed, HTML stripped`image`URL/path returned as string`json`Pretty-printed JSON stringComplex visual types (`ace_editor`, etc.) are automatically excluded from exports.

🔄 Async Export with Progress Tracking
-------------------------------------

[](#-async-export-with-progress-tracking)

For large datasets, exports are processed as queue jobs. The package provides an `ExportProgressTrackerInterface` that you can implement to integrate with your own background task system.

### Interface

[](#interface)

```
use Dimer47\BackpackServerExport\Contracts\ExportProgressTrackerInterface;

interface ExportProgressTrackerInterface
{
    public function create(int $userId, string $origin, array $metadata = []): string|int;
    public function start(string|int $trackerId, int $total): void;
    public function advance(string|int $trackerId, int $done): void;
    public function complete(string|int $trackerId, string $filename): void;
    public function fail(string|int $trackerId, string $error): void;
    public function getDownloadUrl(string|int $trackerId): ?string;
}
```

### Example: Custom Tracker

[](#example-custom-tracker)

```
// app/Adapters/MyExportTracker.php
use Dimer47\BackpackServerExport\Contracts\ExportProgressTrackerInterface;

class MyExportTracker implements ExportProgressTrackerInterface
{
    public function create(int $userId, string $origin, array $metadata = []): int
    {
        return BackgroundTask::create([
            'user_id' => $userId,
            'type' => 'server_export',
            'origin' => $origin,
            'status' => 'pending',
            'metadata' => $metadata,
        ])->id;
    }

    public function start($id, int $total): void
    {
        BackgroundTask::where('id', $id)->update(['status' => 'processing', 'total' => $total]);
    }

    public function advance($id, int $done): void
    {
        BackgroundTask::where('id', $id)->update(['done' => $done]);
    }

    public function complete($id, string $filename): void
    {
        BackgroundTask::where('id', $id)->update(['status' => 'completed', 'filename' => $filename]);
    }

    public function fail($id, string $error): void
    {
        BackgroundTask::where('id', $id)->update(['status' => 'failed', 'error' => $error]);
    }

    public function getDownloadUrl($id): ?string
    {
        return null; // Let your UI handle downloads
    }
}

// app/Providers/AppServiceProvider.php
$this->app->bind(ExportProgressTrackerInterface::class, MyExportTracker::class);
```

> If no tracker is bound, the package uses a `NullProgressTracker` (no-op) — async exports still work, you just don't get progress feedback.

🎨 Custom Formatters
-------------------

[](#-custom-formatters)

Register your own export format:

```
use Dimer47\BackpackServerExport\Contracts\ColumnFormatterInterface;
use Dimer47\BackpackServerExport\Services\ServerExportService;

class JsonFormatter implements ColumnFormatterInterface
{
    public function getIdentifier(): string { return 'json'; }

    public function generate(iterable $rows, array $columns, string $filePath): void
    {
        file_put_contents($filePath, json_encode(iterator_to_array($rows), JSON_PRETTY_PRINT));
    }

    public function getMimeType(): string { return 'application/json'; }
    public function getFileExtension(): string { return 'json'; }
}

// In a service provider:
app(ServerExportService::class)->registerFormatter(new JsonFormatter());
```

🌐 Translations
--------------

[](#-translations)

Publish and customize translations:

```
php artisan vendor:publish --tag=backpack-server-export-lang
```

Available keys:

KeyENFR`button_label`Full ExportExport complet`generating`Generating...Generation...`export_ready`Export ready (:count rows)Export pret (:count lignes)`export_started`Export is being generated. Check background tasks.Export en cours de generation. Consultez les taches en arriere-plan.`format_xlsx`Excel (XLSX)Excel (XLSX)`format_csv`CSVCSV`format_md`MarkdownMarkdown🏗️ How It Works
---------------

[](#️-how-it-works)

### Sync Mode (rows &lt;= threshold)

[](#sync-mode-rows--threshold)

1. User clicks "Full Export" &gt; chooses format
2. JS collects active filters, search term, sort order, visible columns from DataTable state
3. `POST /admin/resource/server-export?filters...` — filters in querystring, format in body
4. Backend applies filters/search/sort on the CRUD query (no pagination)
5. Resolves column values, generates file, returns download URL
6. Browser downloads the file immediately

### Async Mode (rows &gt; threshold)

[](#async-mode-rows--threshold)

1-3. Same as sync 4. Backend counts rows, creates a tracker entry, dispatches a queue job 5. Returns immediately with `{ mode: 'async', tracker_id }`6. Queue job: authenticates as requesting user, bootstraps the CRUD controller, applies filters, processes rows by chunks, generates file, marks tracker as complete 7. User sees progress in their notification center and downloads when ready

📋 Requirements
--------------

[](#-requirements)

DependencyVersionPHP^8.2Laravel^10.0 | ^11.0 | ^12.0 | ^13.0Backpack CRUD^6.0 | ^7.0PhpSpreadsheet^1.29 | ^2.0 *(optional, for XLSX)*📄 License
---------

[](#-license)

MIT — see [LICENSE](LICENSE) for details.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance88

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

60d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a83b52919eaea900b98f8738a168c8ce47ecf7a90853959e1ad1af70246d3cfe?d=identicon)[dimer47](/maintainers/dimer47)

---

Top Contributors

[![dimer47](https://avatars.githubusercontent.com/u/12893613?v=4)](https://github.com/dimer47 "dimer47 (3 commits)")

---

Tags

laravelexportxlsxcsvmarkdowncrudbackpackserver-side

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dimer47-backpack-server-export/health.svg)

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k157.3M914](/packages/maatwebsite-excel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M321](/packages/laravel-horizon)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k27.0M52](/packages/rap2hpoutre-fast-excel)[avadim/fast-excel-laravel

Lightweight and very fast XLSX Excel Spreadsheet Export/Import for Laravel

4058.8k1](/packages/avadim-fast-excel-laravel)

PHPackages © 2026

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