PHPackages                             bezhansalleh/filament-exceptions - 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. [Admin Panels](/categories/admin)
4. /
5. bezhansalleh/filament-exceptions

ActiveLibrary[Admin Panels](/categories/admin)

bezhansalleh/filament-exceptions
================================

A Simple &amp; Beautiful Pluggable Exception Viewer for FilamentPHP's Admin Panel

4.1.0(3mo ago)193195.9k↓19.3%3012MITBladePHP ^8.2

Since Sep 4Pushed 3mo ago5 watchersCompare

[ Source](https://github.com/bezhanSalleh/filament-exceptions)[ Packagist](https://packagist.org/packages/bezhansalleh/filament-exceptions)[ Docs](https://github.com/bezhansalleh/filament-exceptions)[ GitHub Sponsors](https://github.com/bezhanSalleh)[ RSS](/packages/bezhansalleh-filament-exceptions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (27)Used By (12)

[![filament-exceptions-art](https://raw.githubusercontent.com/bezhanSalleh/filament-exceptions/refs/heads/main/art/filament-exceptions.png)](https://github.com/bezhanSalleh/filament-exceptions) [ ![FILAMENT 4.x](https://camo.githubusercontent.com/13befbe0cffd101b2484ce1cdd985dabcddcbf1176d17a675674d53af99cfdbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d342e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentphp.com/docs/4.x/introduction/overview) [ ![FILAMENT 5.x](https://camo.githubusercontent.com/3ec960aa304b803da9f1192f01e82da976a3d220ea85931fec930003e0532c77/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d352e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentphp.com/docs/5.x/introduction/overview) [ ![Packagist](https://camo.githubusercontent.com/7eb97402e7b8e0e4d67974967ec68d902c2dd995c5def73571b9de64238d542a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62657a68616e73616c6c65682f66696c616d656e742d657863657074696f6e732e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374) ](https://packagist.org/packages/bezhansalleh/filament-exceptions) [ ![Tests Passing](https://camo.githubusercontent.com/84579d404355b4c715f3a05bca973c9512252af49ac9ea65983198c16dda3221/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62657a68616e73616c6c65682f66696c616d656e742d657863657074696f6e732f72756e2d74657374732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d7465737473) ](https://github.com/bezhansalleh/filament-exceptions/actions?query=workflow%3Arun-tests+branch%3Amain) [ ![Code Style Passing](https://camo.githubusercontent.com/5380c63b21c1ee7f62f763ee66671c01b77e69d79bfd7d210e68524dcc62e0b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62657a68616e73616c6c65682f66696c616d656e742d657863657074696f6e732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d636f64652532307374796c65) ](https://github.com/bezhansalleh/filament-exceptions/actions?query=workflow%3A)[ ![Downloads](https://camo.githubusercontent.com/e346026cdbed7fd103fb6c9e6db400236356edad016afc13a9451e394a470da4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62657a68616e73616c6c65682f66696c616d656e742d657863657074696f6e732e7376673f7374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/bezhansalleh/filament-exceptions)

Exception Viewer
================

[](#exception-viewer)

A Simple &amp; Beautiful Exception Viewer for FilamentPHP's Admin Panel

> **Version Compatibility:**
>
> - Filament 4.x &amp; 5.x → use version 4.x
> - Filament 3.x → use version 3.x
> - Filament 2.x → use version 1.x

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

[](#installation)

1. You can install the package via composer:

```
composer require bezhansalleh/filament-exceptions
```

2. Publish and run the migration via:

```
php artisan exceptions:install
```

3. Register the plugin for the Filament Panel

```
public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            \BezhanSalleh\FilamentExceptions\FilamentExceptionsPlugin::make()
        ]);
}
```

That's it! The package automatically registers itself with Laravel's exception handler and starts recording exceptions.

Important

The plugin follows Filament's theming rules. So, to use the plugin create a custom theme if you haven't already, and add the following line to your `theme.css` file:

```
@source '../../../../vendor/bezhansalleh/filament-exceptions/resources/views/**/*.blade.php';
```

Now build your theme using:

```
npm run build
```

### Recording Control

[](#recording-control)

By default, exceptions are recorded automatically. You can control this behavior in your `AppServiceProvider`'s `boot()` method:

#### Stop/Start Recording

[](#stopstart-recording)

```
use BezhanSalleh\FilamentExceptions\FilamentExceptions;

public function boot(): void
{
    // Stop recording exceptions
    FilamentExceptions::stopRecording();

    // Resume recording
    FilamentExceptions::startRecording();

    // Check if recording is active
    FilamentExceptions::isRecording();
}
```

#### Conditional Recording

[](#conditional-recording)

Use `recordUsing()` to define custom logic for when exceptions should be recorded:

```
use BezhanSalleh\FilamentExceptions\FilamentExceptions;

public function boot(): void
{
    // Only record in production
    FilamentExceptions::recordUsing(fn () => app()->isProduction());

    // Skip specific exception types
    FilamentExceptions::recordUsing(function (Throwable $e) {
        return ! $e instanceof \Illuminate\Validation\ValidationException
            && ! $e instanceof \Illuminate\Auth\AuthenticationException;
    });

    // Combine multiple conditions
    FilamentExceptions::recordUsing(function (Throwable $e) {
        if (! app()->isProduction()) {
            return false;
        }

        // Skip 4xx HTTP exceptions
        if ($e instanceof \Symfony\Component\HttpKernel\Exception\HttpException
            && $e->getStatusCode() < 500) {
            return false;
        }

        return true;
    });
}
```

### Configuration Options

[](#configuration-options)

When registering the FilamentExceptions plugin, you can chain various methods to customize its behavior. Here are all available configuration options:

#### Navigation

[](#navigation)

```
FilamentExceptionsPlugin::make()
    ->navigationBadge(bool | Closure $condition = true)
    ->navigationBadgeColor(string | array | Closure $color)
    ->navigationGroup(string | Closure | null $group)
    ->navigationParentItem(string | Closure | null $item)
    ->navigationIcon(string | Closure | null $icon)
    ->activeNavigationIcon(string | Closure | null $icon)
    ->navigationLabel(string | Closure | null $label)
    ->navigationSort(int | Closure | null $sort)
    ->registerNavigation(bool | Closure $shouldRegisterNavigation)
    ->subNavigationPosition(SubNavigationPosition | Closure $position)
```

#### Labels and Search

[](#labels-and-search)

```
FilamentExceptionsPlugin::make()
    ->modelLabel(string | Closure | null $label)
    ->pluralModelLabel(string | Closure | null $label)
    ->titleCaseModelLabel(bool | Closure $condition = true)
    ->globallySearchable(bool | Closure $condition = true)
```

#### Mass Pruning Settings

[](#mass-pruning-settings)

```
FilamentExceptionsPlugin::make()
    ->modelPruneInterval(Carbon $interval)
```

> **Note** This requires laravel scheduler to be setup and configured in order to work. You can see how to do that here [Running The Scheduler](https://laravel.com/docs/10.x/scheduling#running-the-scheduler)

#### Tenancy Configuration

[](#tenancy-configuration)

```
FilamentExceptionsPlugin::make()
    ->scopeToTenant(bool | Closure $condition = true)
    ->tenantOwnershipRelationshipName(string | Closure | null $ownershipRelationshipName)
    ->tenantRelationshipName(string | Closure | null $relationshipName)
```

#### General Configuration

[](#general-configuration)

```
FilamentExceptionsPlugin::make()
    ->cluster(string | Closure | null $cluster)
    ->slug(string | Closure | null $slug)
```

Example usage:

```
return $panel
    ->plugins([
        FilamentExceptionsPlugin::make()
            ->navigationLabel('Error Logs')
            ->navigationIcon('heroicon-o-bug-ant')
            ->navigationBadge()
            ->navigationGroup('System')
            ->modelPruneInterval(now()->subDays(7))
    ]);
```

### Custom Exception Model

[](#custom-exception-model)

1. Extend the base model as follow:

```
