PHPackages                             eightynine/filament-reports - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. eightynine/filament-reports

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

eightynine/filament-reports
===========================

Elegant reports in your filament application

4.0.0(7mo ago)9933.8k—6.2%33[5 issues](https://github.com/eighty9nine/filament-reports/issues)[1 PRs](https://github.com/eighty9nine/filament-reports/pulls)MITPHPPHP ^8.2CI passing

Since Dec 17Pushed 7mo ago4 watchersCompare

[ Source](https://github.com/eighty9nine/filament-reports)[ Packagist](https://packagist.org/packages/eightynine/filament-reports)[ Docs](https://github.com/eightynine/filament-reports)[ GitHub Sponsors](https://github.com/eightynine)[ RSS](/packages/eightynine-filament-reports/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (21)Used By (0)

Elegant reports in your filament application
============================================

[](#elegant-reports-in-your-filament-application)

[Check out the demo here](https://filament-reports.eightynine.dev/demo)

[Full Documentation](https://filament-reports.eightynine.dev/docs)

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.0, 11.0, or 12.0
- Filament 4.0 or higher

> **Note:** Laravel 12 support is now available! If you're upgrading from a previous version, please ensure your PHP version is 8.2 or higher as this is required for Laravel 12 compatibility.

> **Breaking Change:** This package now requires Filament v4. If you're using Filament v3, please see the [Upgrade Guide](#upgrade-guide) below.

🛠️ Be Part of the Journey
-------------------------

[](#️-be-part-of-the-journey)

Hi, I'm Eighty Nine. I created reports plugin to solve real problems I faced as a developer. Your sponsorship will allow me to dedicate more time to enhancing these tools and helping more people. [Become a sponsor](https://github.com/sponsors/eighty9nine) and join me in making a positive impact on the developer community.

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

[](#installation)

Then you can install the package via composer:

```
composer require eightynine/filament-reports
```

You can publish the configuration using:

```
php artisan vendor:publish --provider="EightyNine\Reports\ReportsServiceProvider" --tag="reports-config"
```

Usage
-----

[](#usage)

### Register the plugin

[](#register-the-plugin)

Add the plugin to your panel service provider, this is for page discovery and adding the reports to the navigation

```
use EightyNine\Reports\ReportsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('demo')
        ->path('demo')
        ...
        ->plugins([
            ReportsPlugin::make()
        ]);
}
```

### Create your first report

[](#create-your-first-report)

The package comes packed with a report creation command, this will create a report in the `app/Filament/Reports` directory.

```
php artisan make:filament-report UsersReport
```

The command will create a report class with the following structure:

```
namespace App\Filament\Reports;

use EightyNine\Reports\Report;
use Filament\Schemas\Schema;

class UserReport extends Report
{
    public ?string $heading = "Report";

    // public ?string $subHeading = "A report";

    public function header(Schema $schema): Schema
    {
        return $schema->components([
            // Add header components here
        ]);
    }

    public function body(Schema $schema): Schema
    {
        return $schema->components([
            // Add body components here
        ]);
    }

    public function footer(Schema $schema): Schema
    {
        return $schema->components([
            // Add footer components here
        ]);
    }

    public function filterForm(Schema $schema): Schema
    {
        return $schema->components([
            // Add filter form components here
        ]);
    }
}
```

Using Reports in Multiple Panels
--------------------------------

[](#using-reports-in-multiple-panels)

When working with multiple Filament panels (e.g., admin, customer, manager panels), you may want to display different reports in each panel or share reports across specific panels only. The plugin provides several flexible approaches to achieve this:

### 1. Plugin-Level Filtering

[](#1-plugin-level-filtering)

Configure which reports appear in each panel when registering the plugin:

**Allow Only Specific Reports:**

```
// AdminPanelProvider.php
use EightyNine\Reports\ReportsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->id('admin')
        ->plugins([
            ReportsPlugin::make()
                ->reports([
                    \App\Filament\Reports\UserReport::class,
                    \App\Filament\Reports\OrderReport::class,
                    \App\Filament\Reports\FinancialReport::class,
                ])
        ]);
}
```

**Exclude Specific Reports:**

```
// CustomerPanelProvider.php
public function panel(Panel $panel): Panel
{
    return $panel
        ->id('customer')
        ->plugins([
            ReportsPlugin::make()
                ->excludeReports([
                    \App\Filament\Reports\AdminReport::class,
                    \App\Filament\Reports\SystemReport::class,
                ])
        ]);
}
```

**Custom Filter Logic:**

```
// ManagerPanelProvider.php
public function panel(Panel $panel): Panel
{
    return $panel
        ->id('manager')
        ->plugins([
            ReportsPlugin::make()
                ->filterReports(function (string $reportClass, Panel $panel) {
                    $report = app($reportClass);
                    // Only show sales and finance reports to managers
                    return in_array($report->group, ['sales', 'finance']);
                })
        ]);
}
```

### 2. Report-Level Panel Configuration

[](#2-report-level-panel-configuration)

Configure directly in your report class which panels it should appear in:

```
