PHPackages                             sukohi/eloquent-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. [Database &amp; ORM](/categories/database)
4. /
5. sukohi/eloquent-export

ActiveLibrary[Database &amp; ORM](/categories/database)

sukohi/eloquent-export
======================

A Laravel package that allows you to export data from database through Eloquent model.

2.0.3(5y ago)2588MITPHP

Since Nov 21Pushed 5y ago2 watchersCompare

[ Source](https://github.com/SUKOHI/EloquentExport)[ Packagist](https://packagist.org/packages/sukohi/eloquent-export)[ RSS](/packages/sukohi-eloquent-export/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (10)Used By (0)

EloquentExport
==============

[](#eloquentexport)

A Laravel package that allows you to export data from your database through Eloquent model. This package is maintained under Laravel 6.x.

Installation
============

[](#installation)

Execute the following command.

```
composer require sukohi/eloquent-export:2.*

```

Your Eloquent model already has `export()` method after installation.

Usage
=====

[](#usage)

The simplest way
----------------

[](#the-simplest-way)

Call `export()` in your controller.
Only filename required.

```
$users = \App\User::get();

// csv
return $users->export('test.csv');

// xlsx
return $users->export('test.xlsx');

// xls
return $users->export('test.xls');

```

Select column
-------------

[](#select-column)

Downloading data will be narrowed with `select()` method.

```
$users = \App\User::select('id', 'name', 'email')->get();
$users->export('test.csv);  // Only id, name and email data.

```

Options
-------

[](#options)

### Rendering

[](#rendering)

You can change downloading data with key, dot-notation-key, null, callback(s) as follows.

```
$users = \App\User::get();
$options = [
    'render' => [
        'id', // $user->id
        'company.name', // $user->company->name
        null, // blank column
        function($user) {

            return $user->created_at->format('Y.m.d');

        }
    ]
];
return $users->export('test.xls', $options);

```

### Encoding

[](#encoding)

You can specify an encoding to convert data just when downloading csv file.

```
$options = ['encoding' => 'sjis-win'];
return $users->export('test.csv', $options);

```

### Additional data

[](#additional-data)

```
$users = \App\User::get();
$options = [
    'prepend' => [
        ['header - 1', 'header - 2', 'header - 3']
    ],
    'append' => [
        ['footer - 1', 'footer - 2', 'footer - 3']
    ]
];
return $users->export('test.xls', $options);

```

License
=======

[](#license)

This package is licensed under the MIT License.

Copyright 2019 Sukohi Kuhoh

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~23 days

Recently: every ~0 days

Total

9

Last Release

2179d ago

Major Versions

1.0.x-dev → 2.0.02020-05-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/2980d59b309d45df3f2e6e51b1d336614da063240b8f76f873f287cd745ec5db?d=identicon)[Sukohi](/maintainers/Sukohi)

---

Top Contributors

[![SUKOHI](https://avatars.githubusercontent.com/u/5362394?v=4)](https://github.com/SUKOHI "SUKOHI (8 commits)")

### Embed Badge

![Health badge](/badges/sukohi-eloquent-export/health.svg)

```
[![Health](https://phpackages.com/badges/sukohi-eloquent-export/health.svg)](https://phpackages.com/packages/sukohi-eloquent-export)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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