hatchyu / laravel-db-explorer
Database schema and data explorer for Laravel with optional write support
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Vue
pkg:composer/hatchyu/laravel-db-explorer
Requires
- php: ^8.2
- illuminate/auth: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- driftingly/rector-laravel: ^2.1
- laravel/pint: ^1.26
- rector/rector: ^2.3
This package is auto-updated.
Last update: 2026-02-12 20:46:57 UTC
README
⚠️ IMPORTANT NOTICE
This entire package was built using AI tools: Codex, Antigravity, and GitHub Copilot.
No manual coding or manual testing was applied.
Coding standards may not be followed. Use with caution in production.
Please review and test the code thoroughly before deploying to critical systems.
A modern database schema and data explorer for Laravel applications. This package provides a clean and intuitive UI to inspect your database tables, column metadata, browse records, and optionally perform write operations.
Features
- Table Overview: Lists all database tables in a clean, card-based dashboard.
- Table Metadata: View column names, data types, nullability, and primary/foreign keys.
- Records Data Grid Modes:
Rawmode for read-only raw values.Editablemode for formatted values + inline editing controls.
- Inline Editing: Edit records directly in the grid (with type-aware inputs).
- Create / Edit / Delete: Optional write operations with a configurable write mode.
- Presentation Types: Per-column UI control (text, textarea, number, date/time/datetime, boolean, dropdown, foreign key dropdown, color picker).
- Foreign Key UX: Searchable FK dropdowns and FK labels shown as
id - display. - Search: Fast keyword search across all searchable columns in a table.
- Security-First: Restricted by default to specific environments and middleware.
Installation
You can install the package via composer:
composer require hatchyu/laravel-db-explorer
The service provider will be automatically registered.
Publishing Assets
Publish frontend assets (required for proper explorer rendering):
php artisan vendor:publish --tag=db-explorer-assets --force
Optional publishes:
php artisan vendor:publish --tag=db-explorer-config php artisan vendor:publish --tag=db-explorer-views php artisan vendor:publish --tag=db-explorer-migrations
Install / Update Commands
You can use package commands instead of manually publishing tags:
php artisan db-explorer:install php artisan db-explorer:update
Helpful options:
# Include config/views during install php artisan db-explorer:install --with-config --with-views # Force-republish config/views during update php artisan db-explorer:update --with-config --with-views # Skip auto-migrate when write mode is enabled php artisan db-explorer:install --skip-migrate php artisan db-explorer:update --skip-migrate
Quick Start
- Install the package:
composer require hatchyu/laravel-db-explorer
- Publish explorer assets (required for proper UI rendering):
php artisan vendor:publish --tag=db-explorer-assets --force
Or run the package installer:
php artisan db-explorer:install
- Enable explorer in
.env:
DB_EXPLORER_ENABLED=true
- Optional: enable write mode:
DB_EXPLORER_WRITE_ENABLED=true
- If write mode is enabled, run migrations:
php artisan migrate
Then open:
https://your-app.com/db-explorer
Configuration
The configuration file is located at config/db-explorer.php.
return [ /* * Enable or disable the DB Explorer. */ 'enabled' => env('DB_EXPLORER_ENABLED', false), /* * List of environments where the DB Explorer is accessible. */ 'allowed_environments' => [ 'local', ], /* * Controls create/edit/delete actions. * If null, write mode is enabled only in local environment. */ 'write_enabled' => env('DB_EXPLORER_WRITE_ENABLED'), /* * Default records per page for the data browser. */ 'per_page' => 25, /* * Middleware applied to the DB Explorer routes. */ 'middleware' => ['web', 'auth'], ];
Usage
Once installed and enabled, you can access the DB Explorer at:
https://your-app.com/db-explorer
Security
The package includes an EnsureDbExplorerIsAllowed middleware that checks:
- If the explorer is enabled via
DB_EXPLORER_ENABLED. - If the current environment matches
allowed_environments.
You should always keep DB_EXPLORER_ENABLED=false in production unless you have additional security layers.
Write Mode
DB_EXPLORER_WRITE_ENABLED=trueenables create/edit/delete actions.DB_EXPLORER_WRITE_ENABLED=falseforces read-only mode.- If
DB_EXPLORER_WRITE_ENABLEDis not set, write mode is enabled only inlocalenvironment. - Write mode requires running migrations (
php artisan migrate). - Publishing
db-explorer-migrationsis optional (use it only if you want migration files copied into your app).
Customization
If you want to customize the appearance, you can publish the Blade views:
php artisan vendor:publish --tag="db-explorer-views"
The views will be available in resources/views/vendor/db-explorer.
Credits
License
The MIT License (MIT). Please see License File for more information.