ekosuprianto96 / laravel-visual-migrator
Visual Schema Designer for Laravel Migrations (powered by Mongo Diagram)
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/ekosuprianto96/laravel-visual-migrator
Requires
- php: >=8.1
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
README
Laravel Visual Migrator is a powerful visual database schema design tool integrated directly into your Laravel application. Model your tables, fields, and relationships visually and transform them into Laravel migration files instantly.
Key Features
- 🎨 Visual Architecture Builder: Design your database schema using a highly interactive and intuitive diagram interface powered by Vue Flow.
- 🔄 Bidirectional Synchronization:
- Import: Automatically scan your
database/migrationsfolder and visualize your existing tables. - Export: Generate clean, PSR-compliant Laravel migration PHP files from your visual design.
- Import: Automatically scan your
- 🛡️ Draft & Persistence System: Added tables (Drafts) are preserved in your browser's local storage until you officially save them to migrations, preventing work loss on refresh.
- � Layout Stability: Smart merging logic ensures that your custom node positions are preserved even after backend synchronization.
- ⚡ Real-time Change Detection: Automatically detects when migration files are modified on the server and notifies you to sync.
- � Table Selection: Choose specifically which tables you want to export or sync, giving you granular control over your codebase.
Efficiency & Performance
- Optimized Network Traffic: Uses debounced requests for layout saving and throttled polling for change detection.
- Tab Visibility Awareness: Polling automatically pauses when the browser tab is inactive to save system resources.
- Lightweight Metadata: Relationship and layout data are stored efficiently in a single JSON file within your migrations folder.
Installation
Install the package via composer:
composer require ekosuprianto96/laravel-visual-migrator
Publish and setup the package automatically:
php artisan visual-migrator:install
This command will publish assets, configuration, and offers to run the database migrations for you.
How to Access
After installation, the Visual Migrator dashboard is available at:
http://your-app.test/visual-migrator
Note
By default, the dashboard is only accessible in the local environment. You can change the URL path and middleware in the config/visual-migrator.php file.
Useful Commands
Reset Metadata
If you need to reset all visual layout data (node positions), you can use the refresh command:
php artisan visual-migrator:refresh
Cleanup Orphaned Data
If you delete migration files manually, you can clean up the orphaned visual metadata from the database:
php artisan visual-migrator:cleanup
Testing
Run the unit tests using PHPUnit:
cd packages/laravel
composer install
./vendor/bin/phpunit
Configuration
The configuration file is located at config/visual-migrator.php. You can customize the following options:
return [ /** * The URL path where the visual migrator dashboard will be accessible. * Default: 'visual-migrator' */ 'path' => 'visual-migrator', /** * The middleware applied to the visual migrator routes. * Usually 'web' is sufficient for local development. */ 'middleware' => ['web'], /** * List of migration tables to be ignored by the visual migrator. * These tables will not be parsed or displayed in the diagram dashboard. * Perfect for hiding Laravel system/boilerplate tables. */ 'ignore_migrations' => [ 'users', 'password_reset_tokens', 'failed_jobs', 'personal_access_tokens', 'cache', 'jobs', 'job_batches', 'sessions', ], ];
Important
For security reasons, the dashboard is only accessible in the local environment by default.
Why Use Laravel Visual Migrator?
- Speed up Prototyping: Stop writing migrations by hand. Drag, drop, and click to build your core architecture in minutes.
- Visual Documentation: Your diagram is your living documentation. New team members can understand the database structure at a glance.
- Reduced Human Error: Ensure foreign keys and data types are consistent across tables without worrying about syntax errors.
- Non-Destructive: It works alongside your existing migrations. You can selectively sync only what you need.
Future Roadmap
- Visual Seeders: Generate factory and seeder data directly from the diagram.
- Export to Laravel Blueprint: Support for the popular Laravel Blueprint syntax.
- Collaborative Mode: Real-time collaborative design for teams.
- Reverse Engineering Support: Advanced parsing for complex raw SQL dumps.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.