PHPackages                             mrbohem/larasync - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mrbohem/larasync

ActiveLibrary[Database &amp; ORM](/categories/database)

mrbohem/larasync
================

Laravel Database Sync with UI dashboard

v1.5.0(2mo ago)28MITPHPPHP ^8.3CI passing

Since Feb 13Pushed 2mo agoCompare

[ Source](https://github.com/mrbohem/larasync)[ Packagist](https://packagist.org/packages/mrbohem/larasync)[ Docs](https://github.com/mrbohem/larasync)[ GitHub Sponsors](https://github.com/MrBohem)[ RSS](/packages/mrbohem-larasync/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (18)Versions (7)Used By (0)

Larasync – Laravel Database Sync with UI Dashboard
==================================================

[](#larasync--laravel-database-sync-with-ui-dashboard)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d1d05ad175955cf100b4605ff032e46999e757947463cbf347dcba8791779303/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d72626f68656d2f6c61726173796e632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrbohem/larasync)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3ec3057c5f8fb9a6872941eadf021bf126405154a64ac1fa6ebcc72794012475/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d72626f68656d2f6c61726173796e632f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mrbohem/larasync/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/0413ed971d0ac299094aac2b1da2ac2c417efd240ab5dae4882fc341f6bfaa98/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d72626f68656d2f6c61726173796e632f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mrbohem/larasync/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/16cdb538724574c952afb79180ae7dac80ccb6faf35f8c21c8ce0ee138b6c6ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d72626f68656d2f6c61726173796e632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrbohem/larasync)

**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
----------

[](#-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 → DB2` or `DB2 → DB1`
- 🏷️ **Auto-labeling** — databases are auto-detected as *Local* or *Cloud*
- 🚫 **Ignored tables** — exclude tables (e.g. `sessions`, `telescope_*`) from comparison &amp; sync
- 🖥️ **Beautiful Livewire dashboard** — real-time progress, logs, and status indicators
- ⚙️ **Zero config needed** — works out of the box with `.env` variables

---

📋 Requirements
--------------

[](#-requirements)

- PHP **≥ 8.3**
- Laravel **11.x** or **12.x**
- Livewire **3.6+**

---

🚀 Installation
--------------

[](#-installation)

### 1. Install the package via Composer

[](#1-install-the-package-via-composer)

```
composer require mrbohem/larasync --dev
```

### 2. (Optional) Publish the config file

[](#2-optional-publish-the-config-file)

```
php artisan vendor:publish --tag="larasync-config"
```

This creates `config/larasync.php` where you configure your two database connections and ignored tables.

### 3. (Optional) Publish the views

[](#3-optional-publish-the-views)

If you want to customize the dashboard UI:

```
php artisan vendor:publish --tag="larasync-views"
```

---

⚙️ Configuration
----------------

[](#️-configuration)

After publishing, open `config/larasync.php` and configure your two databases. You can set values directly or use `.env` variables:

### Config File

[](#config-file)

```
return [
    'db1' => [
        'driver'   => env('LARASYNC_DB1_DRIVER', 'sqlite'),
        'host'     => env('LARASYNC_DB1_HOST'),
        'port'     => env('LARASYNC_DB1_PORT', '3306'),
        'database' => env('LARASYNC_DB1_DATABASE'),
        'username' => env('LARASYNC_DB1_USERNAME'),
        'password' => env('LARASYNC_DB1_PASSWORD', ''),
    ],

    'db2' => [
        'driver'   => env('LARASYNC_DB2_DRIVER', 'mysql'),
        'host'     => env('LARASYNC_DB2_HOST'),
        'port'     => env('LARASYNC_DB2_PORT', '3306'),
        'database' => env('LARASYNC_DB2_DATABASE'),
        'username' => env('LARASYNC_DB2_USERNAME'),
        'password' => env('LARASYNC_DB2_PASSWORD', ''),
    ],

    'ignored_tables' => [
        'sessions',
        'telescope_entries_tags',
        'telescope_entries',
        'telescope_monitoring',
        'pulse_entries',
        'pulse_values',
        'pulse_aggregates',
    ],
];
```

### `.env` Example

[](#env-example)

```
# ── Database 1 (e.g. local SQLite) ──
LARASYNC_DB1_DRIVER=sqlite
LARASYNC_DB1_DATABASE=database.sqlite

# ── Database 2 (e.g. remote MySQL) ──
LARASYNC_DB2_DRIVER=mysql
LARASYNC_DB2_HOST=your-cloud-db-host.com
LARASYNC_DB2_PORT=3306
LARASYNC_DB2_DATABASE=your_database
LARASYNC_DB2_USERNAME=your_username
LARASYNC_DB2_PASSWORD=your_password
```

> **Note:** For SQLite, the `database` value is resolved relative to Laravel's `database_path()` (i.e. the `database/` directory).

---

🖥️ Usage
--------

[](#️-usage)

### Access the Dashboard

[](#access-the-dashboard)

Once installed, visit the sync dashboard in your browser:

```
https://your-app.test/sync-db

```

The route is automatically registered by the package at `/sync-db`.

### Dashboard Workflow

[](#dashboard-workflow)

1. **Configure connections** — Enter or verify the credentials for DB1 and DB2 (pre-filled from config)
2. **Test connections** — Click the test button for each database to verify connectivity
3. **Compare** — Hit "Compare" to see a table-by-table row-count comparison
4. **Choose sync direction** — Select `DB1 → DB2` or `DB2 → DB1`
5. **Sync** — Sync individual tables with one click, or use "Sync All" to sync every table sequentially

### Supported Drivers

[](#supported-drivers)

DriverValueNotesSQLite`sqlite`Always treated as *Local*MySQL`mysql`Local or Cloud auto-detectedPostgreSQL`pgsql`Local or Cloud auto-detected### Ignoring Tables

[](#ignoring-tables)

Add table names to the `ignored_tables` array in `config/larasync.php` to exclude them from comparison and sync:

```
'ignored_tables' => [
    'sessions',
    'telescope_entries',
    'jobs',
    'failed_jobs',
    // add your tables here...
],
```

---

⚠️ Important Notes
------------------

[](#️-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 the `web` middleware by default. You may want to add authentication middleware in production — see [Protecting the Dashboard](#-protecting-the-dashboard).

---

🔒 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:

```
// In routes/web.php
use MrBohem\Larasync\Http\Livewire\SyncDashboard;

Route::get('sync-db', SyncDashboard::class)
    ->middleware(['web', 'auth', 'admin'])  // add your middleware
    ->name('larasync.dashboard');
```

---

🧪 Testing
---------

[](#-testing)

```
composer test
```

---

👤 Credits
---------

[](#-credits)

- [MrBohem](https://github.com/mrbohem)
- [All Contributors](../../contributors)

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance85

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

6

Last Release

78d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/48591126?v=4)[Shivam Upadhyay](/maintainers/mrbohem)[@mrbohem](https://github.com/mrbohem)

---

Top Contributors

[![mrbohem](https://avatars.githubusercontent.com/u/48591126?v=4)](https://github.com/mrbohem "mrbohem (17 commits)")

---

Tags

backup-databaselaravelsync-databaselaravelmrbohemlarasync

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mrbohem-larasync/health.svg)

```
[![Health](https://phpackages.com/badges/mrbohem-larasync/health.svg)](https://phpackages.com/packages/mrbohem-larasync)
```

###  Alternatives

[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[spatie/laravel-model-flags

Add flags to Eloquent models

4301.1M1](/packages/spatie-laravel-model-flags)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[spatie/laravel-sql-commenter

Add comments to SQL queries made by Laravel

1931.4M1](/packages/spatie-laravel-sql-commenter)[spatie/laravel-deleted-models

Automatically copy deleted records to a separate table

409109.8k4](/packages/spatie-laravel-deleted-models)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

203330.1k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
