PHPackages                             php-dominicana/laravel-model-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. php-dominicana/laravel-model-export

ActiveLaravel-package[PDF &amp; Document Generation](/categories/documents)

php-dominicana/laravel-model-export
===================================

This is a simple package to export model to csv, json

v0.0.3(10mo ago)211MITPHP

Since Jun 20Pushed 10mo agoCompare

[ Source](https://github.com/PHP-Dominicana/laravel-model-export)[ Packagist](https://packagist.org/packages/php-dominicana/laravel-model-export)[ RSS](/packages/php-dominicana-laravel-model-export/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (4)Used By (0)

laravel-model-export
====================

[](#laravel-model-export)

A lightweight Laravel package to export Eloquent model data to CSV, excel, with support for low-memory, lazy exports and a clean API via an `Exportable` trait and query macro.

📦 Features
----------

[](#-features)

- Export model data to CSV using a simple method call
- Export via query chaining (`User::where(...)->exportToExcel()`)
- Low memory usage via `lazyById()`
- Customizable export paths

---

🚀 Installation
--------------

[](#-installation)

```
composer require php-dominicana/laravel-model-export
```

### 🛠 Usage

[](#-usage)

Export all records (static call)

```
User::exportToExcel(); // uses default filename and $exportable columns
```

### Export filtered data via query

[](#export-filtered-data-via-query)

```
User::where('active', true)
    ->orderBy('name')
    ->exportToExcel(); // exports only active users

```

### Export to custom path

[](#export-to-custom-path)

```
User::exportToExcel(storage_path('exports/users.csv'));

```

### 📁 File Output

[](#-file-output)

- Files are exported to /storage/app by default unless a custom path is provided.
- Filenames follow this format: export\_ModelName\_TIMESTAMP.csv

### Export to browser

[](#export-to-browser)

```
User::streamDownload();

```

### Export to JSON

[](#export-to-json)

```
User::exportToJson();

```

### Export to PDF

[](#export-to-pdf)

```
User::exportToPDF();

```

### Customize the PDF View (Optional)

[](#customize-the-pdf-view-optional)

To let users override your default PDF view, instruct them to publish it:

```
php artisan vendor:publish --tag=model-export-views

```

### 🧠 How It Works

[](#-how-it-works)

- The Exportable trait adds a static exportToExcel() method for convenience.
- A macro is registered on Eloquent\\Builder so that you can chain -&gt;exportToExcel() on queries.
- Under the hood, Spatie’s SimpleExcelWriter handles the CSV generation.
- Memory-efficient thanks to Laravel’s lazyById().

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance53

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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

Every ~1 days

Total

3

Last Release

324d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17c416be607cbb47c55e76e115e3c35c3d74906ff422e808e4bba3be1dfb5cd6?d=identicon)[masterfermin02](/maintainers/masterfermin02)

---

Top Contributors

[![masterfermin02](https://avatars.githubusercontent.com/u/4625540?v=4)](https://github.com/masterfermin02 "masterfermin02 (14 commits)")

---

Tags

excel-exportexportjsonpdf

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/php-dominicana-laravel-model-export/health.svg)

```
[![Health](https://phpackages.com/badges/php-dominicana-laravel-model-export/health.svg)](https://phpackages.com/packages/php-dominicana-laravel-model-export)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[spatie/laravel-pdf

Create PDFs in Laravel apps

9963.4M12](/packages/spatie-laravel-pdf)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[lukasss93/laravel-larex

Translate your Laravel application from a single CSV file!

9790.3k2](/packages/lukasss93-laravel-larex)

PHPackages © 2026

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