yadakhov / laradump by yadakhov

A mysqldump wrapper for laravel. Dump your table schemas and data into files.
8,028
25
3
Package Data
Maintainer Username: yadakhov
Maintainer Contact: yada.khov@gmail.com (Yada Khov)
Package Create Date: 2016-08-02
Package Last Update: 2023-08-09
Language: PHP
License: MIT
Last Refreshed: 2024-04-26 03:00:49
Package Statistics
Total Downloads: 8,028
Monthly Downloads: 183
Daily Downloads: 10
Total Stars: 25
Total Watchers: 3
Total Forks: 1
Total Open Issues: 0

Laradump

A wrapper package to run mysqldump from laravel console commands.

Installation

Install from packagist

composer require yadakhov/laradump

Or add to your composer.json

    "require": {
        "yadakhov/laradump": "^1.0"
    },

Add to providers array in config/app.php

    'providers' => [
        // ...others

        Yadakhov\Laradump\LaradumpServiceProvider::class,
    ],

Create configuration file config/laradump.php.

php artisan vendor:publish

Laradump commands

Once the LaradumpServiceProvider is registered, the commands will show up when you do a php artisan.

php artisan
 ...
 laradump
  laradump:list       List all tables to perform individually.
  laradump:mysqldump  Perform a MySQL dump.
  laradump:restore    Perform a restore.
 ...

Doing a mysqldump

php artisan laradump:mysqldump

Will perform a mysqldump of each table in your database and store it in the storage/dumps folder.

Doing a mysql restore

php artisan laradump:restore

Will load all sql files in /storage/dumps.

Perform backup and restore on individual table

php artisan laradump:mysqldump  --table=user
php artisan laradump:restore  --table=user

# To see a list of possible tables
php artisan laradump:list 

Ensure the storage folder is writable.

# Create the tables for storing the files
mkdir storage/laradump/tables
mkdir storage/laradump/data

sudo chmod o+w -R storage