PHPackages                             ruelluna/laravel-db-pull-production - 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. ruelluna/laravel-db-pull-production

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

ruelluna/laravel-db-pull-production
===================================

Artisan command to pull production MySQL database via SSH

1.0.1(3mo ago)17↓66.7%MITPHPPHP ^8.2

Since Feb 15Pushed 3mo agoCompare

[ Source](https://github.com/ruelluna/laravel-db-pull-production)[ Packagist](https://packagist.org/packages/ruelluna/laravel-db-pull-production)[ RSS](/packages/ruelluna-laravel-db-pull-production/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Laravel DB Pull Production
==========================

[](#laravel-db-pull-production)

Artisan command to pull a production MySQL database via SSH and replace your local database. Ideal for Laravel Forge deployments.

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

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- MySQL as default database connection
- SSH access to production server
- `ssh`, `mysqldump`, and `mysql` in your system PATH

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

[](#installation)

```
composer require ruelluna/laravel-db-pull-production
```

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

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=db-pull-production-config
```

Add these variables to your `.env`:

```
# Production DB Pull (db:pull-production)
PRODUCTION_SSH_HOST=
PRODUCTION_SSH_USER=forge
PRODUCTION_SSH_PORT=22
PRODUCTION_SSH_KEY_PATH=
PRODUCTION_DB_HOST=127.0.0.1
PRODUCTION_DB_PORT=3306
PRODUCTION_DB_DATABASE=
PRODUCTION_DB_USERNAME=forge
PRODUCTION_DB_PASSWORD=

# Optional: sync mode timeout in seconds (default 600, 0 = unlimited)
# DB_PULL_PRODUCTION_TIMEOUT=600

# Optional: job timeout in seconds when using --async (default 3600)
# DB_PULL_PRODUCTION_JOB_TIMEOUT=3600
```

**Note:** On Windows, use forward slashes for `PRODUCTION_SSH_KEY_PATH` (e.g. `C:/Users/Name/.ssh/id_rsa`) to avoid dotenv escape issues.

Usage
-----

[](#usage)

```
php artisan db:pull-production
```

### Options

[](#options)

OptionDescription`--force`Run even when `APP_ENV=production` (use with caution)`--no-backup`Skip backing up your local database before replace`--async`Dispatch as a queued job instead of running synchronously (avoids timeout for large databases)`--timeout=`Process timeout in seconds for sync mode (0 = unlimited). Overrides config.### Examples

[](#examples)

```
# Pull production database (backs up local first)
php artisan db:pull-production

# Skip local backup
php artisan db:pull-production --no-backup

# Override production check (e.g. when running in staging)
php artisan db:pull-production --force

# Run as background job (requires queue worker: php artisan queue:work)
php artisan db:pull-production --async --no-backup

# Sync mode with custom timeout (e.g. 20 minutes)
php artisan db:pull-production --no-backup --timeout=1200
```

Security
--------

[](#security)

The command **refuses to run** when `APP_ENV=production` unless you pass `--force`. This prevents accidentally overwriting your production database with local data.

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

[](#how-it-works)

1. Validates that required config is present
2. Backs up your local database to `storage/app/backups/` (unless `--no-backup`)
3. SSHs into the production server
4. Runs `mysqldump` on the remote MySQL instance
5. Pipes the dump into your local `mysql` for import

**Large databases:** The sync command uses a configurable timeout (default 600 seconds). For very large databases, use `--async` to run as a queued job—ensure a queue worker is running (`php artisan queue:work`) and use a queue driver other than `sync` (e.g. `database` or `redis`) for true background execution.

**Progress display:** The command shows real percentage progress during backup, dump, and import. On Linux/macOS, `pv` (pipe viewer) is used for import progress when available (`brew install pv` / `apt install pv`). On Windows, a pure PHP streaming approach is used—no extra tools required.

Testing
-------

[](#testing)

```
./vendor/bin/pest
```

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance82

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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 ~0 days

Total

2

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f36b7ca408511a362849c31ab6b1f2da4c609373dd827edf33d612e28764be9?d=identicon)[ruelluna](/maintainers/ruelluna)

---

Top Contributors

[![ruelluna](https://avatars.githubusercontent.com/u/982036?v=4)](https://github.com/ruelluna "ruelluna (5 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/ruelluna-laravel-db-pull-production/health.svg)

```
[![Health](https://phpackages.com/badges/ruelluna-laravel-db-pull-production/health.svg)](https://phpackages.com/packages/ruelluna-laravel-db-pull-production)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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