Skip to content

Crumbls/filament-database

Repository files navigation

Filament Database Administration

A phpMyAdmin-style database manager for Laravel Filament. Browse tables, edit rows, manage schema, run SQL — all from your Filament admin panel.

Requirement Minimum Version
PHP 8.3
Laravel 12.0 – 13.x
Filament 5.0

Screenshots

Database Overview

Database Overview

Table Browser

Table Browser

Installation

composer require crumbls/filament-database

Setup

Register the plugin in your Filament panel provider:

use Crumbls\FilamentDatabase\FilamentDatabasePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FilamentDatabasePlugin::make()
                ->authorize(function() { 
                    // You need to customize this. It controls who can view it.
                    return false; 
                }),
        ]);
}

Features

  • Database overview — stats dashboard with table counts, row counts, and largest tables at a glance
  • Connection switcher — hot-swap between database connections with health checking
  • Table browser — searchable table list with row counts, one-click selection
  • Row CRUD — paginated rows with sort, search, inline edit, insert, delete
  • Bulk operations — select multiple rows for bulk delete or export
  • Copy row as — copy any row as PHP array, JSON, SQL INSERT, or Laravel factory format
  • Structure viewer — columns with types, nullable, defaults, and inline editing
  • Column management — add, rename, modify, and drop columns
  • Index viewer — all indexes with columns and uniqueness
  • Foreign key viewer — constraints with ON UPDATE/DELETE actions
  • Relationships tab — visual map of incoming and outgoing foreign key relationships
  • SQL runner — execute raw queries with tabular results, query history, and Cmd/Ctrl+Enter shortcut
  • Query EXPLAIN — EXPLAIN/ANALYZE support for MySQL, PostgreSQL, and SQLite
  • Schema snapshots — capture your entire database schema as JSON, compare against previous snapshots with color-coded diffs
  • Migration generator — generate Laravel migration code from schema diffs, copy or save directly to database/migrations/
  • Export — download table data as CSV, JSON, or SQL INSERT statements
  • Import — upload CSV files with automatic column mapping
  • Table operations — create, truncate, drop tables with confirmation dialogs
  • Dark mode — full support via Filament CSS variables
  • Audit logging — optional query and change logging

Configuration

Publish the config:

php artisan vendor:publish --tag=filament-database-config

Plugin API

FilamentDatabasePlugin::make()
    // Access control
    ->authorize(fn () => auth()->user()->is_admin)
    ->onlyForEmails(['admin@example.com'])

    // Connections
    ->connections(['mysql', 'sqlite'])
    ->excludeConnections(['pgsql'])
    ->defaultConnection('mysql')

    // Safety
    ->readOnly()
    ->preventDestructive()
    ->requireConfirmation()

    // Table visibility
    ->hideTables(['password_resets', 'failed_jobs'])
    ->showOnlyTables(['users', 'posts'])

    // SQL runner
    ->disableQueryRunner()
    ->queryRunnerReadOnly()

    // UI
    ->navigationGroup('System')
    ->navigationIcon('heroicon-o-circle-stack')
    ->navigationSort(100)
    ->navigationLabel('Database')
    ->rowsPerPage(25)
    ->maxRowsPerPage(500)

    // Audit
    ->logQueries()
    ->logChanges()

Security

This package gives direct database access. Access is denied to all users by default — you must explicitly grant access via one of the authorization methods below.

Authorization (required)

// Closure — full control
FilamentDatabasePlugin::make()
    ->authorize(fn () => auth()->user()->is_admin)

// Laravel Gate
FilamentDatabasePlugin::make()
    ->authorizeUsing('manage-database')

// Email allowlist
FilamentDatabasePlugin::make()
    ->onlyForEmails(['admin@example.com'])

Recommended production settings

FilamentDatabasePlugin::make()
    ->authorize(fn () => auth()->user()->is_admin)
    ->readOnly()                          // block all writes
    ->preventDestructive()                // block DROP / TRUNCATE
    ->connections(['mysql'])              // limit to specific connections
    ->logQueries()                        // audit all SQL
    ->logChanges()                        // audit all data changes

Testing

composer test

177 tests, 390 assertions.

License

MIT

About

A Filament 5+ database browser that emulates PhpMyAdmin, but for other systems. Built for with love for Laravel.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors