Download the PHP package sridhar-s-subramanian/filament-dbview without Composer

On this page you can find all versions of the php package sridhar-s-subramanian/filament-dbview. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-dbview

Filament DB View

Latest Version on Packagist Total Downloads PHP Version

An Adminer-like, read-only database viewer for Filament panels. By default it is scoped to your app's Eloquent models and gives you two ways to explore data:

By default the viewer is scoped to Eloquent models your app discovers. The Query Runner can optionally list every table on an allowed connection (->allTables()) so you can run SELECTs without a model — see Query Runner scope.

AI assistants / agents: start with AGENTS.md for a configuration checklist (install, defaults, gates, audit, production). This README has the full narrative docs.

Requirements

Installation

Register the plugin on your panel:

The migrations create two package tables (both ship by default):

History writes and UI are opt-in (features.history defaults to false) so the table does not grow unbounded on busy panels. The table may still be empty after migrate until you enable the feature:

PSR-3 audit logging always runs, whether or not history is enabled.

Features

Database Browser

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

Query Runner

An Adminer-style console for SQL-literate users:

Moving between the two

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

Query Runner scope

The Database Browser is always limited to model-backed tables.

The Query Runner defaults to the same (scope = models), but can be widened so operators can run SELECTs against any real table on an allowed connection — including tables that have no Eloquent model. That is intentional: use it when you need Adminer-style ad-hoc reads beyond the model map.

Scope How to enable Tables listed / queryable
models (default) (default) Only discovered Eloquent models
connection ->allTables() or queryRunnerScope('connection') Every real table on the connection

Details:

Query history is off by default (the dbview_query_history migration still ships). Enable the feature with ->history() or features.history => true when you want the Query Runner to persist and re-load per-user queries. PSR-3 audit logging is separate and always runs — see Auditing.

Model discovery & registry cache

The package scans your app for concrete Eloquent models and builds a registry (model → table → connection → columns / FKs). That registry is the default table allowlist for:

With ->allTables() / scope = connection, the Runner can also list other real tables on the connection; discovery still drives the Browser and model-backed labels/links. Per-user table_gate filters the registry further when set (see Authorization).

Configuration knobs

Key Default Purpose
models.paths [app_path('Models')] Directories to scan for *.php model classes
models.exclude [] Fully-qualified class names to never register (global)
models.cache.enabled true (FILAMENT_DBVIEW_CACHE) Cache the registry to avoid filesystem/schema work every request
models.cache.ttl 3600 (seconds) Cache lifetime; null = until manually cleared
models.cache.store null Cache store name; null = default store
models.cache.key filament-dbview.registry Cache key

Exclude vs table_gate vs allTables

Mechanism Scope Use when
models.exclude All users; model never enters the registry Table should not be browsable as a model at all
authorization.table_gate Per user; filters the registry Some roles may see orders, others may not
->allTables() Query Runner only Need SELECT on tables without an Eloquent model

Cache & deploys

With cache enabled (default), the registry is stored for ttl seconds. After you:

run:

Add that command to your deploy script when registry cache is on in production, so new models show up immediately instead of waiting for TTL.

For local development you can disable the cache:

Abstract models, interfaces, and classes that are not subclasses of Illuminate\Database\Eloquent\Model are ignored. Models whose table/connection cannot be introspected are skipped (not fatal).

Auditing

Every Query Runner attempt (allowed or denied) is written as a structured PSR-3 log line for accountability. This is always on and independent of query history.

Destination Default Contains full SQL?
PSR-3 log (audit.log_channel) On (app default logger) Yes (audit.log_sql default true)
dbview_query_history table / UI Off (features.history) Yes, when history is enabled

Typical log context:

Configuration

Example dedicated channel in config/logging.php (host app):

Then:

Operational notes

Authorization (opt-in)

Access is allow by default for anyone who can open your Filament panel. This package does not ship a roles system and does not depend on Spatie Permission, Filament Shield, Bouncer, or similar. Panel login is enough unless you opt in to extra checks.

To restrict by role or permission, point the package at Laravel Gate ability names. Any roles plugin (or your own logic) can define those abilities — the package only calls Gate::allows(...).

Config key Default When set (opt-in)
authorization.gate null → allow User must pass this ability to open Browser and Runner
authorization.query_runner_gate null → allow Extra ability required for Query Runner only
authorization.table_gate null → all in-scope tables Per-table filter; ability receives the table name
authorization.export_gate null → allow if export is on Extra ability required for CSV/JSON export

1. Publish config (if you have not already)

2. Define Gate abilities in your app

Register them in AppServiceProvider, AuthServiceProvider, or wherever you define policies — using whatever permission system you already have.

Custom / simple:

Spatie Laravel Permission (or any package that exposes $user->can(...)):

Ability names are arbitrary — use whatever strings you prefer, then mirror them in config.

3. Point the package at those abilities

In config/filament-dbview.php:

Or via environment-driven config if you prefer:

Export: feature flag vs gate

Goal Config
Export on for everyone who can use the Query Runner (default) features.export => true, export_gate => null
Export only for some roles features.export => true, export_gate => 'exportDbview' (define the Gate)
No export for anyone features.export => false (hides CSV/JSON entirely)

Behaviour summary

If you do not need role-based restrictions, leave the authorization section untouched.

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 many write/DDL/file/DoS tokens (INSERT, UPDATE, DROP, INTO OUTFILE, LOAD_FILE, SLEEP, lock helpers, …) are rejected. Strings and comments are stripped before keyword scanning. Schema/database-qualified names (other_db.users) are refused. Prefer a SELECT-only DB user as the strongest write barrier (see below).
  2. Table scope — default models scope: only discovered models the user may see. connection scope (->allTables()): any real table on an allowed connection (optional denyTables()). The Browser is always model-only.
  3. Connection allowlist — the runner may only use connections derived from discovered models (or an explicit connections.allowed list).
  4. Enforced LIMIT and statement timeout cap runaway queries.
  5. Rolled-back transaction (Query Runner) — reads run inside a transaction that is always rolled back (including EXPLAIN ANALYZE). The Browser uses Eloquent reads with optional read-only connection remaps and timeouts.
  6. Optional dedicated read-only connection — map app connections to a DB user granted only SELECT (recommended for production).

SQL analysis limits

The Query Runner uses a lexical analyzer (SqlAnalyzer), not a full SQL engine grammar. It is built for security questions (one statement? read-only? which tables? sensitive columns?) and is intentionally fail-closed on many ambiguous forms.

What it handles well today:

Practical guidance:

Additional controls:

Configuration

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

After changing models or discovery config with the registry cache enabled, clear it (see Model discovery & registry cache):

Development

Changelog

See CHANGELOG.md for a list of changes per release.

License

MIT. See LICENSE.md.


All versions of filament-dbview with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^4.0|^5.0
greenlion/php-sql-parser Version ^4.7
illuminate/contracts Version >=11.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sridhar-s-subramanian/filament-dbview contains the following files

Loading the files please wait ...