PHPackages                             n02srt/laravel-staging-sync - 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. n02srt/laravel-staging-sync

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

n02srt/laravel-staging-sync
===========================

A Laravel package to automatically sync staging databases with production, including data anonymization.

01PHP

Since Apr 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/N02SRT/laravel-staging-sync)[ Packagist](https://packagist.org/packages/n02srt/laravel-staging-sync)[ RSS](/packages/n02srt-laravel-staging-sync/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Staging Sync
====================

[](#laravel-staging-sync)

A Laravel package that keeps your **staging database in sync with production**, safely and selectively. Useful for automated QA environments, pre-release testing, and reducing the overhead of managing up-to-date test data.

---

🚀 Features
----------

[](#-features)

- Sync data from production to staging
- Select specific tables to sync or use `--all` to sync everything
- Exclude or obfuscate sensitive columns
- Truncate staging tables before syncing
- Dry-run mode for safe simulation
- Batch processing to handle large tables
- Console command for manual or scheduled syncs

---

📦 Installation
--------------

[](#-installation)

```
composer require n02srt/laravel-staging-sync
php artisan vendor:publish --tag=staging-sync-config
```

---

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

[](#️-configuration)

Edit the published config file at `config/staging-sync.php`:

```
return [
    'tables' => [
        'users' => [
            'exclude_columns' => ['password', 'email'],
            'obfuscate' => ['email'],
        ],
        'orders',
        'products',
    ],
    'batch_size' => 500,
    'truncate_before_insert' => true,
    'dry_run' => false,
];
```

Define source/target connections in your `.env` file:

```
STAGING_SYNC_SOURCE_DB_CONNECTION=production
STAGING_SYNC_TARGET_DB_CONNECTION=staging
```

---

🛠 Usage
-------

[](#-usage)

### Run the Sync

[](#run-the-sync)

```
php artisan staging:sync
```

### Options

[](#options)

- `--dry-run` — Simulate syncing without writing to the staging DB
- `--all` — Sync all tables from the source DB, except those in `exclude_tables`

### Examples

[](#examples)

```
php artisan staging:sync --dry-run
php artisan staging:sync --all
```

---

🧪 Advanced Use
--------------

[](#-advanced-use)

### Scheduling

[](#scheduling)

Add the command to your `App\Console\Kernel.php`:

```
$schedule->command('staging:sync --all')->dailyAt('02:00');
```

### Obfuscation

[](#obfuscation)

To protect sensitive data in staging, configure fields under `obfuscate`. Emails and similar fields will be replaced with hashed dummy values.

---

🧱 Package Structure
-------------------

[](#-package-structure)

- `src/StagingSyncServiceProvider.php` — Service provider
- `src/Console/SyncStagingCommand.php` — Artisan command
- `config/staging-sync.php` — Configuration file

---

✅ Roadmap
---------

[](#-roadmap)

- ✅ Initial release with config + Artisan support
- ✅ `--all` support for syncing all tables
- ⏳ Web interface (Filament/Nova)
- ⏳ Slack/email notifications
- ⏳ Queue integration for async syncing

---

🧑‍💻 License
-----------

[](#‍-license)

MIT License — free to use, modify, and distribute.

---

Made with ❤️ to make staging feel less like guesswork.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3256eb24f6e1dd1776a0fcfcc5294cff27d3a7dfc450acceb0f96a7310def8bb?d=identicon)[N02SRT](/maintainers/N02SRT)

---

Top Contributors

[![N02SRT](https://avatars.githubusercontent.com/u/14588565?v=4)](https://github.com/N02SRT "N02SRT (3 commits)")

### Embed Badge

![Health badge](/badges/n02srt-laravel-staging-sync/health.svg)

```
[![Health](https://phpackages.com/badges/n02srt-laravel-staging-sync/health.svg)](https://phpackages.com/packages/n02srt-laravel-staging-sync)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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