PHPackages                             osama-98/laravel-exports - 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. osama-98/laravel-exports

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

osama-98/laravel-exports
========================

A Laravel package for exporting data in batches and chunks with support for CSV and XLSX formats

0.2.0(5mo ago)60[4 PRs](https://github.com/osama-98/laravel-exports/pulls)MITPHPPHP ^8.1CI passing

Since Jan 14Pushed 3mo agoCompare

[ Source](https://github.com/osama-98/laravel-exports)[ Packagist](https://packagist.org/packages/osama-98/laravel-exports)[ Docs](https://github.com/osama-98/laravel-exports)[ GitHub Sponsors](https://github.com/osama-98)[ RSS](/packages/osama-98-laravel-exports/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (9)Versions (9)Used By (0)

Laravel Exports
===============

[](#laravel-exports)

[![Latest Version on Packagist](https://camo.githubusercontent.com/674de19da5575dbc9c270132bf62d15d780ae7538d5d28def921f5eb9bfc6bb8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f73616d612d39382f6c61726176656c2d6578706f7274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/osama-98/laravel-exports)[![Total Downloads](https://camo.githubusercontent.com/1bff360347dc166f85af4481e8e27932519407b877f2366e5d0ebfe63a959895/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f73616d612d39382f6c61726176656c2d6578706f7274732e737667)](https://packagist.org/packages/osama-98/laravel-exports)[![License](https://camo.githubusercontent.com/66356852f7adda5331897efe9680c8f39b9ff9009e37033d33ef96b972b854c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f73616d612d39382f6c61726176656c2d6578706f7274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/osama-98/laravel-exports)

A powerful Laravel package for exporting large datasets in batches and chunks with support for CSV and XLSX formats. This package provides a clean, fluent API for handling exports efficiently.

Features
--------

[](#features)

- ✅ **Batch &amp; Chunk Processing** - Handle large datasets efficiently with configurable chunk sizes
- ✅ **Queue-Based Exports** - Process exports asynchronously using Laravel queues
- ✅ **Multiple Formats** - Export to both CSV and XLSX formats
- ✅ **Column Mapping** - Customize column names and labels
- ✅ **Progress Tracking** - Monitor export progress with detailed status information
- ✅ **Query Builder Support** - Works with both Eloquent Builder and Query Builder
- ✅ **Fluent API** - Laravel-style fluent interface for easy configuration
- ✅ **Relationship Support** - Export related model data with aggregations
- ✅ **Custom Formatting** - Format dates, numbers, and custom values
- ✅ **Storage Flexibility** - Support for local, S3, and custom storage disks
- ✅ **Event System** - Listen to export completion events

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0, 11.0, or 12.0
- Queue driver configured (database, redis, sqs, etc.)

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

[](#installation)

Install the package via Composer:

```
composer require osama-98/laravel-exports
```

Publish and run the migrations:

```
# Publish the package migrations
php artisan vendor:publish --tag=laravel-exports-migrations

# Publish Laravel's queue migrations (required for job batching)
php artisan queue:batches-table
php artisan migrate
```

**Note:** The `job_batches` table is required for queue batching functionality. If you're using the database queue driver, you'll also need the `jobs` and `failed_jobs` tables:

```
php artisan queue:table
php artisan queue:failed-table
php artisan migrate
```

The package will automatically register its service provider.

Quick Start
-----------

[](#quick-start)

### 1. Create an Exporter

[](#1-create-an-exporter)

Create an exporter class that extends `Osama\LaravelExports\Exports\Exporter`:

```
