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(6y ago)2588MITPHP

Since Nov 21Pushed 6y 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 3w ago

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 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

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

2235d 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

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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