PHPackages                             sridhar-s-subramanian/filament-dbview - 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. [Database &amp; ORM](/categories/database)
4. /
5. sridhar-s-subramanian/filament-dbview

ActiveLibrary[Database &amp; ORM](/categories/database)

sridhar-s-subramanian/filament-dbview
=====================================

Adminer-like, strictly read-only database viewer for Filament panels, scoped to the host app's Eloquent models.

v1.4.0(1mo ago)5390↑125%MITPHPPHP ^8.2

Since Jul 2Pushed 1mo agoCompare

[ Source](https://github.com/sridhar-s-subramanian/filament-dbview)[ Packagist](https://packagist.org/packages/sridhar-s-subramanian/filament-dbview)[ RSS](/packages/sridhar-s-subramanian-filament-dbview/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (33)Versions (8)Used By (0)

Filament DB View
================

[](#filament-db-view)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a67a600ed0712df0beed6699411c772e236df225f3604e9b32f68ed4d7a6afc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737269646861722d732d73756272616d616e69616e2f66696c616d656e742d6462766965772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sridhar-s-subramanian/filament-dbview)[![Total Downloads](https://camo.githubusercontent.com/29ba932a1debcfd143dbd2716f235305c1d65a0582110e7d2fc9bc0c6640fc72/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737269646861722d732d73756272616d616e69616e2f66696c616d656e742d6462766965772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sridhar-s-subramanian/filament-dbview)[![PHP Version](https://camo.githubusercontent.com/84cf7e987931fe005513784aa30e6da4fb2cdd2938060383b40ad3832d356a64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f737269646861722d732d73756272616d616e69616e2f66696c616d656e742d6462766965772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sridhar-s-subramanian/filament-dbview)[![License](https://camo.githubusercontent.com/e132e83b0e9c8e80aa1bfa96c85f782a546021a2842e036f7710d6d63c2cc97d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737269646861722d732d73756272616d616e69616e2f66696c616d656e742d6462766965772e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

An Adminer-like, **strictly read-only** database viewer for [Filament](https://filamentphp.com)panels. It is scoped to your Laravel app's Eloquent models and gives you two ways to explore data:

- **Database Browser** — pick any model-backed table and browse it with Filament's native table (search, sort, per-column filters, pagination), a full-record slide-over, and one-click relationship previews via detected foreign keys.
- **Query Runner** — run ad-hoc `SELECT` queries in an Adminer-style console, with `EXPLAIN` / `EXPLAIN ANALYZE`, a table **structure** view (columns, indexes, foreign keys), CSV/JSON export, per-user query history, and saved queries.

Everything the viewer can reach is defined by the models it discovers — nothing else is exposed.

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

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- Filament v4 or v5

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

[](#installation)

```
composer require sridhar-s-subramanian/filament-dbview
php artisan vendor:publish --tag="filament-dbview-config"
php artisan vendor:publish --tag="filament-dbview-migrations"
php artisan migrate
```

Register the plugin on your panel:

```
use SridharSSubramanian\FilamentDbview\DbviewPlugin;

public function panel(Panel $panel): Panel
{
    return $panel->plugin(DbviewPlugin::make());
}
```

The migrations create two small tables (`dbview_query_history`, `dbview_saved_queries`) used by the Query Runner's history and saved-query features. If you don't use those features you can skip the migration step and turn them off in the config.

Features
--------

[](#features)

### Database Browser

[](#database-browser)

A point-and-click browser for one model-backed table at a time — no SQL required:

- Filament's native table with **search**, **click-to-sort**, **column show/hide**(remembered per table), and pagination.
- **Adminer-style filters** auto-derived from each column's type (text / number / date / boolean), combinable with AND/OR groups.
- **Row detail** slide-over showing the full record with long/JSON values expanded.
- **Relationship previews** — one action per foreign key (`→ Related`) opens the related rows in a modal, so you can follow relationships without writing joins.
- A bookmarkable `?table=` URL, so a table can be linked or shared.

### Query Runner

[](#query-runner)

An Adminer-style console for SQL-literate users:

- Run a single read-only `SELECT` / `WITH … SELECT`. Results render in an ad-hoc grid with a row-detail slide-over. Press `⌘/Ctrl + Enter` to run.
- **EXPLAIN** and **EXPLAIN ANALYZE** — inspect a query's plan. You never type `EXPLAIN`; the typed `SELECT` passes the same read-only guards and only then is a driver-appropriate prefix prepended, so the analysed statement is always a single SELECT. `EXPLAIN ANALYZE` executes the query to collect real timings, still row-capped, timed out, and rolled back.
- **Show structure** — the sidebar lists tables; each has a structure icon that shows the table's **columns** (name, type, nullable, default, PK/auto-increment), **indexes**, and **foreign keys**, Adminer-style.
- **Export** results to CSV or JSON, a per-user **query history**, and **saved queries**.
- A searchable **table sidebar** — click a table name to insert it into the editor, the structure icon to inspect it, or the browse link to open it in the Database Browser.

### Moving between the two

[](#moving-between-the-two)

The two tools are cross-linked so a table flows from one lens to the other without retyping:

- **Runner → Browser**: model-backed tables in the Runner sidebar have a **Browse**link that opens them in the Database Browser.
- **Browser → Runner**: the Browser's **Query** and **Structure** header actions open the Query Runner with the current table prefilled (`SELECT * FROM `) or on its structure view.

Query Runner scope
------------------

[](#query-runner-scope)

The Database Browser is always limited to model-backed tables. The Query Runner defaults to the same, but can be widened to any table on an allowed connection:

```
$panel->plugin(
    DbviewPlugin::make()
        ->allTables()                                   // query any real table
        ->denyTables(['password_reset_tokens', 'sessions']), // …except these
);
```

`->allTables()` is shorthand for `->queryRunnerScope('connection')`. Read-only guards and column redaction still apply to every table. These setters take precedence over the `query_runner` values in the config file.

Security model (read-only in depth)
-----------------------------------

[](#security-model-read-only-in-depth)

Direct database access is guarded on multiple, independent layers — see `ReadOnlyGuard`:

1. **Lexical allowlist** — only a single `SELECT` / `WITH … SELECT` statement is accepted. Stacked statements, executable comments (`/*! … */`, `/*+ … */`), and write/DDL/file/DoS tokens (`INSERT`, `UPDATE`, `DROP`, `INTO OUTFILE`, `LOAD_FILE`, `pg_read_file`, `SLEEP`, `BENCHMARK`, …) are rejected. Keywords hidden inside string literals or comments cannot fool the analyzer.
2. **Table scope** — every referenced table must belong to a discovered model the current user is allowed to see. System tables are never reachable.
3. **Enforced `LIMIT`** and **statement timeout** cap runaway queries.
4. **Rolled-back transaction** — reads execute inside a transaction that is always rolled back, so nothing can persist even if a layer above were bypassed. This also covers `EXPLAIN ANALYZE`, which executes its (SELECT-only) target.
5. **Optional dedicated read-only connection** — route all queries through a database user granted only `SELECT` (the strongest control).

Additional controls:

- **Sensitive-column redaction** (`password`, `*_token`, `*_secret`, …) in the browser, the runner, and every export.
- **Deny-by-default authorization** via configurable gates (page, query-runner, and per-table).
- **Auditing** of every allowed/denied attempt to a PSR-3 channel and the history table.

Configuration
-------------

[](#configuration)

Everything is configured in `config/filament-dbview.php`. The most useful knobs:

```
'models' => [
    'paths'   => [app_path('Models')], // scanned for Eloquent models (the allowlist)
    'exclude' => [],                    // fully-qualified model classes to skip
    'cache'   => ['enabled' => true, 'ttl' => 3600, /* … */],
],

'connections' => [
    'allowed'   => null,                 // null = every connection a model uses
    'read_only' => [],                   // e.g. ['mysql' => 'mysql_readonly']
],

'limits' => [
    'default_rows'     => 100,
    'max_rows'         => 1000,
    'timeout'          => 15,            // statement timeout (seconds)
    'max_result_bytes' => 5 * 1024 * 1024,
],

'redact' => ['password', '*_token', '*_secret', /* … */],

'features' => [
    'query_runner'         => true,
    'explain'              => true,      // EXPLAIN / EXPLAIN ANALYZE buttons
    'structure'            => true,      // "Show structure" (columns/indexes/FKs)
    'export'               => true,
    'history'              => true,
    'saved_queries'        => true,
    'relationship_preview' => true,      // FK preview actions in the browser
],

'query_runner' => [
    'scope' => 'models',                 // 'models' | 'connection'
    'deny'  => [],                       // blocked even in 'connection' scope
],

'authorization' => [
    'gate'              => null,         // gate checked before any dbview page
    'query_runner_gate' => null,         // additionally guards the SELECT runner
    'table_gate'        => null,         // per-table filter (receives table name)
],

'audit' => ['log_channel' => null],      // PSR-3 channel for audit lines
```

After changing `models.paths` (or your models) with the registry cache enabled, clear it with:

```
php artisan filament-dbview:clear
```

Development
-----------

[](#development)

```
composer test        # Pest + Testbench (incl. OWASP security suite)
composer analyse     # PHPStan / Larastan
composer format      # Pint (PER)
composer lint        # PHP_CodeSniffer (PSR-12)
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for a list of changes per release.

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance92

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

7

Last Release

36d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2076e9a15cf94ea1dedd1a279ea8f2c1b5695a968ce67ed44dd94867dd15f0e9?d=identicon)[sridhar-s-subramanian](/maintainers/sridhar-s-subramanian)

---

Top Contributors

[![sridhar-s-subramanian](https://avatars.githubusercontent.com/u/70995897?v=4)](https://github.com/sridhar-s-subramanian "sridhar-s-subramanian (17 commits)")

---

Tags

laraveldatabasesqlRead onlyfilamentadminerdbview

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sridhar-s-subramanian-filament-dbview/health.svg)

```
[![Health](https://phpackages.com/badges/sridhar-s-subramanian-filament-dbview/health.svg)](https://phpackages.com/packages/sridhar-s-subramanian-filament-dbview)
```

###  Alternatives

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

316.8k2](/packages/finity-labs-fin-mail)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17861.9k3](/packages/stephenjude-filament-jetstream)[backstage/mails

View logged mails and events in a beautiful Filament UI.

16429.7k](/packages/backstage-mails)[stephenjude/filament-debugger

About

104173.6k2](/packages/stephenjude-filament-debugger)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

16461.2k](/packages/relaticle-custom-fields)

PHPackages © 2026

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