PHPackages                             rudi97277/export-db - 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. rudi97277/export-db

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

rudi97277/export-db
===================

Export data to XLSX or CSV formats from database queries or functions

v1.0.2(1y ago)022MITPHP

Since Nov 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/rudi97277/export-db)[ Packagist](https://packagist.org/packages/rudi97277/export-db)[ RSS](/packages/rudi97277-export-db/feed)WikiDiscussions main Synced 1mo ago

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

install this package using `composer require rudi97277/export-db`

How to Use This Package
-----------------------

[](#how-to-use-this-package)

1. **Run the Migration**

    - Execute the migration to create the necessary database structure.
2. **Table Creation**

    - A new table named `export_configs` will be generated.
3. **Insert Data**

    - Insert new data into the `export_configs` table to create a new report.
4. **Create a New Route**

    - Define a new route that creates an instance of the `Rudi9277/ExportDb/GenerateReport` class and calls the `generate` function. Pass the `request` as a parameter.

    **Example route definition:**

    ```
    Route::get('export', function () {
        return Rudi9277\ExportDb\GenerateReport::generate(request());
    });
    ```
5. **Run Symlink**

    - If you never run a symlink command before, please run it `php artisan storage:link`

**Note:**

- Available `export_type` are `xlsx` and `csv`.
- You can create a new module in the database.

**Table columns:**

1. **module**: The name of the module that will be exported.
2. **title**: The title of the sheet in the Excel that will be generated.
3. **query**: The query that will be used to generate the Excel.
4. **formatter**: JSON object that will help format the data the way you want.

    **Example:**

    ```
    [
      {
        "name": "Product",
        "value": "--- {product_name} ----"
      }
    ]
    ```

    **Note:**

    - The `"name"` key is the header in the Excel that will be generated.
    - `{product_name}` is the column name in the SQL query result.
5. **validator**: JSON object that will help to validate the required data for the query. The validator is from [Laravel Validator](https://laravel.com/docs/11.x/validation).

    **Example:**

    ```
    {
      "name": "required|string"
    }
    ```
6. **default**: A default JSON object that sets what the default value of the validator in No. 5 is.

    **Example:**

    ```
    {
      "name": null
    }
    ```
7. To style the data, you can use ExportDTO to pass callable function to the generator like this example

    ```
    Route::get('export', function () {
         $style = function (Worksheet $sheet) {
             return [
                 'A' => [
                     'alignment' => [
                         'horizontal' => Alignment::HORIZONTAL_CENTER,
                     ],
                 ],
             ];
         };

         $reg = function () {
             return [
                 AfterSheet::class => function ($event) {
                     $sheet = $event->sheet->getDelegate();
                     $sheet->getStyle('B:B')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
                 },
             ];
         };

         $dto = new ExportDTO($func, $style);

         return  Rudi97277\ExportDb\GenerateReport::generate(request(),$dto);
    });
    ```

    please check [Laravel Excel](https://laravel-excel.com/) how to use the styles

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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

Total

3

Last Release

465d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79ea294ce5e47bdb3b8620186989c9f78f7c06616c8f556252cdf1cc444e7c4d?d=identicon)[rudi97277](/maintainers/rudi97277)

---

Top Contributors

[![rudi97277](https://avatars.githubusercontent.com/u/45420193?v=4)](https://github.com/rudi97277 "rudi97277 (15 commits)")

---

Tags

phplaravelexcelcsvPHPExcelphpspreadsheetdatabase export

### Embed Badge

![Health badge](/badges/rudi97277-export-db/health.svg)

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M710](/packages/maatwebsite-excel)

PHPackages © 2026

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