v1.0.0

Oliver
2026-02-10T15:56:24Z

Main features for 1.0.0

See merge request lbyit/laravel-db-pull!9

Laravel DB Pull

A powerful, interactive CLI tool for Laravel developers to securely pull remote databases into local environments via SSH tunnels. Designed for Laravel 12+, it features a modern interactive wizard and granular control over table data.

Features

Interactive Wizard: Powered by Laravel Prompts for a seamless setup experience.

SSH Tunneling: Securely connect to remote databases without exposing ports.

Table Management:

Full Skip: Exclude tables entirely (no structure, no data).

Structure Only: Import table definitions without any data.

Data Filtering: Use SQL WHERE clauses to import only partial data (e.g., last 3 months of logs).

Environment Aware: Automatically manages .env variables and configuration files.

Safety First: Environment guards prevent accidental overwrites in production.

Installation

composer require lbyit/laravel-db-pull --dev

Setup

Run the interactive wizard to add your first remote environment (e.g., production, staging):

php artisan db:pull-add

The wizard will guide you through:

1. SSH Connection details (Host, User, Port, Private Key).

2. Database credentials.

3. Analyzing remote tables for advanced filtering.

To edit an existing environment:

php artisan db:pull-edit

Usage

To pull a remote database into your local instance:

php artisan db:pull

If you have multiple remotes configured, you will be prompted to select one.

How it works

The process executes in three safe stages:

1. Structure Stage: Creates all table definitions (respecting your skip list).

2. Base Data Stage: Imports data for all tables not marked for filtering or structure-only.

3. Filtered Data Stage: Imports specific data based on your custom WHERE clauses.

Configuration

The package stores connection templates in config/db-pull.php and sensitive credentials in your .env file.

Example Config Structure

'production' => [
    'ssh_host' => env('DB_PULL_PRODUCTION_SSH_HOST'),
    // ...
    'options' => [
        'skip_tables' => ['logs_backup', 'temp_data'],
        'exclude_data' => ['activity_log', 'sessions'],
        'filters' => [
            'orders' => 'created_at >= DATE_SUB(NOW(), INTERVAL 6 MONTH)',
        ],
    ],
],

Requirements

PHP: 8.2+

Laravel: 12.0+

Local Binaries: ssh, mysql, mysqldump

Remote Access: SSH access to the remote server and permission to run mysqldump.

Made with ♥️ by LBY IT