PHPackages                             leyton/clevexport - 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. leyton/clevexport

ActiveLibrary

leyton/clevexport
=================

A Clever mechanism to export large data asynchronously

v1.1(3y ago)52145[4 issues](https://github.com/leyton-group/clevexport/issues)Apache-2.0PHPPHP &gt;=7.4

Since Feb 24Pushed 3y ago4 watchersCompare

[ Source](https://github.com/leyton-group/clevexport)[ Packagist](https://packagist.org/packages/leyton/clevexport)[ RSS](/packages/leyton-clevexport/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Motivation
----------

[](#motivation)

The goal of this Laravel package is to execute the exportation to **EXCEL** large data/records that may cause in the crash of the server or a timeout. The idea is to divide the process in sub operations managable and easy to perform.

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

[](#installation)

```
compose require leyton/clevexport

```

After the installation make sure to publish the assets

```
php artisan vendor:publish --provider="Leyton\ClevExportServiceProvider"

```

You will find the `config/clevexport.php` file containing all the configurations needed.

```
return [
    // array of listeners that will be executed once the execution is done
    'listeners' => [],

    // if you want to stock the user who started the export
    'with_owner' => true,

    // the guard
    'guard' => 'web',

    // the foreign key name in the exports table
    'owner_id' => 'user_id',

    // The Authenticable class
    'owner_class' => \App\Models\User:class,

    // Number of chunks
    'chunks' => 10,
];
```

Then you can run your migration

```
php artisan migrate

```

Usage
-----

[](#usage)

The `QueryFinder` should be provided with an instance of an object that implements the `IseExportable` Interface

```
 $dossierExporter = QueryFinder::getInstance($this->defaultDossierService, $this->transformer);

 PreparingExportJob::dispatch($dossierExporter, $request->all())->delay(now()->addSecond());
```

A second Parameter is optional and if is provided it should implement the `ShouldHandleResult` It is where you can perform extra work on the results and provide the headers in a `ExportTransformed` container If the second parameter is not provided then the headers will be the column names selected from the query.

Exportable
----------

[](#exportable)

```
class UserExportable implements IsExportable
{

    /**
     * @param array $params
     * @return Builder
     */
    public function query(array $params): Builder
    {
        return  User::select('id', 'name', 'email')
            ->addSelect([
                'title' => Post::selectRaw('SUBSTRING(`content`, 1, 10) as `title`')->limit(1)
            ]);
    }
}
```

Transformer
-----------

[](#transformer)

```
class UserTransformer implements ShouldHandleResult
{

    public function transform($data): ExportTransformed
    {
        $data =   $data->map(function(User $user){
            $user->most_commented = optional($user->posts()->withCount('comments')->first())->comments_count;
            $user->comments_count = $user->comments()->count();
            $user->posts_count = $user->posts()->count();
            return $user;
        });

        return  new ExportTransformed(['id', 'name', 'email', 'title', 'Most commented', 'Comments count', 'Posts count'], $data->toArray());
    }
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

2

Last Release

1230d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fbeb774293770efe72dfe486b323e999e6d65d0df0db9052a1e5b76d9711efe?d=identicon)[akiyamaSM](/maintainers/akiyamaSM)

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

---

Top Contributors

[![akiyamaSM](https://avatars.githubusercontent.com/u/12276076?v=4)](https://github.com/akiyamaSM "akiyamaSM (5 commits)")[![medito](https://avatars.githubusercontent.com/u/6362694?v=4)](https://github.com/medito "medito (5 commits)")[![MehdiAroui](https://avatars.githubusercontent.com/u/10630880?v=4)](https://github.com/MehdiAroui "MehdiAroui (2 commits)")

### Embed Badge

![Health badge](/badges/leyton-clevexport/health.svg)

```
[![Health](https://phpackages.com/badges/leyton-clevexport/health.svg)](https://phpackages.com/packages/leyton-clevexport)
```

###  Alternatives

[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1225.0k10](/packages/fleetbase-core-api)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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