PHPackages                             marceli-to/laravel-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. marceli-to/laravel-sync

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

marceli-to/laravel-sync
=======================

Sync the production database and storage assets from remote Laravel environments to local.

v1.0.0(1mo ago)07↓87.5%MITPHPPHP ^8.1

Since May 29Pushed 1mo agoCompare

[ Source](https://github.com/marceli-to/laravel-sync)[ Packagist](https://packagist.org/packages/marceli-to/laravel-sync)[ RSS](/packages/marceli-to-laravel-sync/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel Sync
============

[](#laravel-sync)

Pull the production database and storage assets from a remote Laravel environment to your local setup — no FTP, no SSH, just one artisan command.

How It Works
------------

[](#how-it-works)

1. The package exposes protected endpoints on your remote site.
2. `sync:pull` downloads a gzipped `mysqldump` of the remote database and imports it into your local database.
3. For assets, it compares local and remote files via hash manifests and streams only new, changed, and deleted files as compressed `tar.gz` archives.

First run downloads everything. Subsequent asset runs only sync the diff.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, 12, or 13
- MySQL / MariaDB
- `mysqldump`, `mysql`, `gzip`/`gunzip`, and `tar` available on the relevant machines (standard on Linux/macOS)

Installation
------------

[](#installation)

Install the package on **both** your local and remote environments:

```
composer require marceli-to/laravel-sync
```

Configuration
-------------

[](#configuration)

Publish the config (optional — defaults work out of the box):

```
php artisan vendor:publish --tag=laravel-sync-config
```

### Environment Variables

[](#environment-variables)

**Both environments** (local + remote):

```
LARAVEL_SYNC_TOKEN=your-shared-secret-here
```

Generate a secure token:

```
openssl rand -hex 32
```

**Local environment only:**

```
LARAVEL_SYNC_REMOTE=https://your-production-site.com
```

Usage
-----

[](#usage)

### Pull everything (database + assets)

[](#pull-everything-database--assets)

```
php artisan sync:pull
```

### Pull only the database

[](#pull-only-the-database)

```
php artisan sync:pull --only=database
```

### Pull only assets

[](#pull-only-assets)

```
php artisan sync:pull --only=assets
```

### Dry run (see what would change)

[](#dry-run-see-what-would-change)

```
php artisan sync:pull --dry-run
```

### Force full asset sync (skip delta comparison)

[](#force-full-asset-sync-skip-delta-comparison)

```
php artisan sync:pull --full
```

### Skip confirmation prompts

[](#skip-confirmation-prompts)

```
php artisan sync:pull --force
```

Safety
------

[](#safety)

Importing the remote database **overwrites your local database**. To protect against accidents:

- The command **refuses to run** if the local `APP_ENV` is `production`.
- It asks for confirmation before importing (skip with `--force`).
- Database credentials are passed via a temporary `--defaults-extra-file`, so they never appear in the process list.

Configuration Options
---------------------

[](#configuration-options)

```
// config/laravel-sync.php

return [
    // Shared secret for authentication (required on both sides)
    'token' => env('LARAVEL_SYNC_TOKEN', ''),

    // Remote URL to pull from (local side only)
    'remote' => env('LARAVEL_SYNC_REMOTE', ''),

    // Database connection to dump/import (null = default). MySQL only.
    'connection' => env('LARAVEL_SYNC_CONNECTION'),

    // Asset directories to sync (relative to project root).
    // Add entries to limit the sync to specific sub-folders.
    'paths' => [
        'assets' => 'storage/app/public',
    ],

    // URL prefix for the sync endpoints
    'route_prefix' => '_sync',

    // Optional IP whitelist (empty = allow all, token still required)
    'allowed_ips' => [],
];
```

Updating
--------

[](#updating)

```
composer update marceli-to/laravel-sync
```

Remember to update on **both** local and remote when upgrading.

Security
--------

[](#security)

- All requests require a valid bearer token (compared in constant time).
- The `/_sync/database` endpoint can stream your entire database — use a strong, unique token and consider the IP whitelist.
- Optional IP whitelisting for additional protection.
- Directory traversal protection on asset file serving.

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance89

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52077649?v=4)[marceli.to](/maintainers/marceli-to)[@marceli-to](https://github.com/marceli-to)

---

Top Contributors

[![marceli-to](https://avatars.githubusercontent.com/u/52077649?v=4)](https://github.com/marceli-to "marceli-to (1 commits)")

### Embed Badge

![Health badge](/badges/marceli-to-laravel-sync/health.svg)

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

###  Alternatives

[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k4.0k](/packages/leantime-leantime)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11223.5M33](/packages/anourvalar-eloquent-serialize)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k8](/packages/statamic-rad-pack-runway)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3518.3k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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