DbManager is a Laravel Artisan command to manage your database interactively via the console. It allows you to explore tables, view records, generate fake data, and create migrations and seeders.
- List all database tables
- View rows in tables with summarized columns
- Drill down to row details
- Insert fake data into tables with Faker
- Generate migration files for tables
- Generate seeder classes for tables
- Handles foreign key relationships when inserting fake data
- Clone or download the repository into your Laravel project:
git clone https://github.com/ezmu/Db-Manager.git- Ensure the command file is located in:
app/Console/Commands/DbManager.php
- Register the command in
app/Console/Kernel.php:
protected $commands = [
\App\Console\Commands\DbManager::class,
];Run the command using Artisan:
php artisan db:manageYou will see an interactive menu.
-
Main Menu
- Show Tables
- Insert Fake Data
- Manage Seeds
- View All Seeders
- View All Migrations
-
Show Tables
- Lists all tables in the database
- Select a table to view its rows
-
Table Rows
- Displays rows in the selected table (summary view)
- Select a row to see full details
-
Row Details
- Shows all columns for the selected row
-
Insert Fake Data
- Select a table to insert fake data
- Automatically handles foreign key dependencies
-
Manage Seeds
- Generate seeder classes for tables
- View existing seeders and their related tables
-
View Migrations
- Lists migration files
- Displays the fields and types for each table
- PHP 8+
- Laravel 8+
fakerphp/fakerdoctrine/dbal- Symfony Console (included with Laravel)
- Faker generates realistic data for testing.
- Doctrine DBAL is used for schema introspection.
- Supports MySQL, PostgreSQL, SQLite, and SQL Server.
MIT License
EzEldeen A. Y. Mushtaha GitHub: https://github.com/ezmu LinkedIn: https://www.linkedin.com/in/ezmush/