PHPackages                             lageg/reporter - 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. lageg/reporter

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

lageg/reporter
==============

Laravel Reporter

v1.1.0(1w ago)128↑1292.9%[1 issues](https://github.com/git-gustavolage/lageg-laravel-reporter/issues)MITPHPPHP ^8.1

Since Mar 9Pushed 3d agoCompare

[ Source](https://github.com/git-gustavolage/lageg-laravel-reporter)[ Packagist](https://packagist.org/packages/lageg/reporter)[ RSS](/packages/lageg-reporter/feed)WikiDiscussions main Synced today

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

Lageg Laravel Reporter
======================

[](#lageg-laravel-reporter)

Reporter is a php laravel library to report build orchestrate using the **Reporter Facade**. You can define your own drivers for the report build with the lib of your preference, such as **Mpdf**, **Spatie Laravel PDF**, **Laravel Excel** and many others.

### Instalation and configuration

[](#instalation-and-configuration)

You can install the package by using the following command:

```
composer require lageg/reporter
```

By default the package will use the default driver set on config/reporter.php.

You can publish the config with the following command:

```
php artisan vendor:publish --tag=reporter
```

You can define the default driver for whatever you want:

```
/**
 * The default driver
 */
'default_driver' => 'pdf',
```

If in your application you want to use different drivers, you can set the configuration for each driver you want to use:

```
'drivers' => [
    'csv' => [
        'class' => MyCsvDriver::class,
        'config' => []
    ]
]
```

### Drivers

[](#drivers)

Here is an example of the implementation of a custom driver, the driver here uses the Mpdf lib to generate a pdf file. The driver implicit require the exportable to register an HtmlComponent, the component that will be used to get the HTML data to build the pdf file.

```
class MpdfDriver implements Driver
{
    public function generate(Exportable $exportable, array $config = []): Report
    {
        $mpdf = new Mpdf();
        $html = $exportable->query(HtmlComponent::class);

        if (!$html) {
            throw new Exception('Exporter must provide an html component');
        }

        $mpdf->writeHtml($html->value());

        $content = $mpdf->output();

        return new Report(
            $content,
            'application/pdf',
            $exportable->getFilename() . '.pdf'
        );
    }
}
```

### Components

[](#components)

You can use Componets to share data across layers in your application, while your exportable can access and manipulate Models, API's or external files, in your driver you just want to use the data, and you can do so by using Components.

In order to use the component in your driver you should first **register** the component in the exportable. The base **Exporter** class provides four function to interact with components: **components**, **register**, **has** and **query**.

```
class ExampleWithHtmlComponent extends Exporter

    public function __construct()
    {
        $this->register($this->html());
    }

    private function html()
    {
        return new HtmlComponent("Here is all the HTML");
    }
}
```

You can also use **alias** for register the component

```
class ExampleWithComponentAlias extends Exporter

    public function __construct()
    {
        $this->register(
            component: new HtmlComponent("here is an example"),
            alias: 'example'
        );
    }
}
```

```
//Driver

$component = $exportable->query('example'); //HtmlComponent

//you can also use the class name resolution
$component = $exportable->query(HtmlComponent::class); //HtmlComponent

//a not registered component will return null
$component = $exportable->query(NotRegisteredComponent::class); //null
```

### Facade

[](#facade)

The convenient way to orchestrate the build of your report is by using the **Reporter Facade**.

```
$exportable = new ExampleExportable();

$report = Reporter::make($exportable)->generate();
```

You can also specify the driver you want to use to build the report.

```
//using a configured driver
$report = Reporter::make($exportable)
    ->using('xlsx')
    ->generate();

//using class name resolution
$report = Reporter::make($exportable)
    ->using(MyCustomDriver::class)
    ->generate();

//using the default driver
$report = Reporter::make($exportable)->generate();
```

You can also provide custom configuration for your driver by using the **config** method:

```
$exportable = new ExampleExportable();

$config = ['orientation' => 'Landscape'];

$report = Reporter::make($exportable)
    ->using(MyCustomDriver::class)
    ->config($config)
    ->generate();
```

You can define default configurations in the config/reporter.php file:

```
'drivers' => [
    'pdf' => [
        'class' => MyPdfDriver::class,
        'config' => [
            'orientation' => 'Landscape',
            'format' => 'a4',
            'margins' => ['24mm', '24mm', '24mm', '24mm']
        ]
    ]
]
```

You are free to define the config the way you want and use it in your driver

```
class MyCustomPdfDriver implements Driver
{
    public function generate(Exportable $exportable, array $config = []): Report
    {
        $pdf = new Pdf();

        if ($orientation = $config['orientation'] ?? null) {
            $pdf->orientation($orientation);
        }

        if ($format = $config['format'] ?? null) {
            $pdf->format($format);
        }

        //generate the file...
    }
}
```

The generate method returns a Report instance that can be used to respond, download, store, or output the generated report.

```
$report = Facade::make($exportable)->generate();

// Returns a response that serves the generated file from a temporary location
return $report->response();

// Returns an HTTP response that forces the file download with proper headers
return $report->download();

// Stores the report content on the given disk and path, returning the stored path
$path = $report->store('s3', 'reports');

// Writes the report to a temporary file and returns its full path
$path = $report->output();
```

###  Health Score

37

—

LowBetter than 84% of packages

Maintenance79

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Total

3

Last Release

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7023ff1142f74213a27dfe2813dc1fa881a14ea5addeca2ffcef30820ca6d86d?d=identicon)[git-gustavolage](/maintainers/git-gustavolage)

---

Top Contributors

[![git-gustavolage](https://avatars.githubusercontent.com/u/153939276?v=4)](https://github.com/git-gustavolage "git-gustavolage (26 commits)")

---

Tags

laravelpdfexportexcelreport

### Embed Badge

![Health badge](/badges/lageg-reporter/health.svg)

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k140.5M629](/packages/maatwebsite-excel)[jimmyjs/laravel-report-generator

Rapidly Generate Simple Pdf &amp; Excel Report on Laravel 5 (Using Barryvdh/DomPdf or Barryvdh/laravel-snappy &amp; maatwebsite/excel)

589154.9k1](/packages/jimmyjs-laravel-report-generator)[avadim/fast-excel-laravel

Lightweight and very fast XLSX Excel Spreadsheet Export/Import for Laravel

4042.7k1](/packages/avadim-fast-excel-laravel)[samuelterra22/laravel-report-generator

Rapidly Generate Simple Pdf, Excel &amp; CSV Reports on Laravel (Using Barryvdh/DomPdf or Barryvdh/laravel-snappy &amp; maatwebsite/excel)

125.3k](/packages/samuelterra22-laravel-report-generator)

PHPackages © 2026

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