Download the PHP package mrbohem/larasync without Composer
On this page you can find all versions of the php package mrbohem/larasync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mrbohem/larasync
More information about mrbohem/larasync
Files in mrbohem/larasync
Package larasync
Short Description Laravel Database Sync with UI dashboard
License MIT
Homepage https://github.com/mrbohem/larasync
Informations about the package larasync
Larasync โ Laravel Database Sync with UI Dashboard
Larasync is a Laravel package that lets you compare and sync data between two databases through a beautiful Livewire-powered web dashboard. Connect any combination of SQLite, MySQL, or PostgreSQL databases, see a side-by-side row-count comparison for every table, and sync individual tables or all tables at once โ right from your browser.
โจ Features
- ๐ Connect any two databases โ SQLite, MySQL, or PostgreSQL
- ๐ Side-by-side table comparison โ row counts, diff, and sync status at a glance
- ๐ One-click sync โ sync a single table or all tables sequentially
- โ๏ธ Bi-directional sync โ choose
DB1 โ DB2orDB2 โ DB1 - ๐ท๏ธ Auto-labeling โ databases are auto-detected as Local or Cloud
- ๐ซ Ignored tables โ exclude tables (e.g.
sessions,telescope_*) from comparison & sync - ๐ฅ๏ธ Beautiful Livewire dashboard โ real-time progress, logs, and status indicators
- โ๏ธ Zero config needed โ works out of the box with
.envvariables
๐ Requirements
- PHP โฅ 8.3
- Laravel 11.x or 12.x
- Livewire 3.6+
๐ Installation
1. Install the package via Composer
2. (Optional) Publish the config file
This creates config/larasync.php where you configure your two database connections and ignored tables.
3. (Optional) Publish the views
If you want to customize the dashboard UI:
โ๏ธ Configuration
After publishing, open config/larasync.php and configure your two databases. You can set values directly or use .env variables:
Config File
.env Example
Note: For SQLite, the
databasevalue is resolved relative to Laravel'sdatabase_path()(i.e. thedatabase/directory).
๐ฅ๏ธ Usage
Access the Dashboard
Once installed, visit the sync dashboard in your browser:
The route is automatically registered by the package at /sync-db.
Dashboard Workflow
- Configure connections โ Enter or verify the credentials for DB1 and DB2 (pre-filled from config)
- Test connections โ Click the test button for each database to verify connectivity
- Compare โ Hit "Compare" to see a table-by-table row-count comparison
- Choose sync direction โ Select
DB1 โ DB2orDB2 โ DB1 - Sync โ Sync individual tables with one click, or use "Sync All" to sync every table sequentially
Supported Drivers
| Driver | Value | Notes |
|---|---|---|
| SQLite | sqlite |
Always treated as Local |
| MySQL | mysql |
Local or Cloud auto-detected |
| PostgreSQL | pgsql |
Local or Cloud auto-detected |
Ignoring Tables
Add table names to the ignored_tables array in config/larasync.php to exclude them from comparison and sync:
โ ๏ธ Important Notes
- Sync is destructive โ Syncing a table will truncate the target table and replace all its data with the source table's data. Always back up your databases before syncing.
- Foreign key constraints are temporarily disabled during sync to avoid constraint violations.
- Large tables are synced in chunks of 500 rows for efficiency.
- The dashboard route (
/sync-db) uses thewebmiddleware by default. You may want to add authentication middleware in production โ see Protecting the Dashboard.
๐ Protecting the Dashboard
The /sync-db route uses only the web middleware by default. In production, you should protect it with authentication. You can do this by adding middleware in your app's route service provider or by overriding the package route:
๐งช Testing
๐ค Credits
- MrBohem
- All Contributors
๐ License
The MIT License (MIT). Please see License File for more information.
All versions of larasync with dependencies
illuminate/contracts Version ^11.0||^12.0
livewire/livewire Version ^3.6
spatie/laravel-package-tools Version ^1.16