New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

elimuswift/db-exporter

Export your database quickly and easily as a Laravel Migration and all the data as a Seeder class.
4,710 35

Larablocks Analysis

elimuswift/db-exporter works with Laravel 5 (latest release v1.2.5, Sep 19, 2018), which reached end of life: no more fixes, even for security.

Laravel 4 in earlier releases.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: Sep 19, 2018)
  • 1 downloads a month (needs 10,000)
  • 35 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Sep 19, 2018.
  • No releases in the last 12 months.
  • First released: Dec 7, 2016.
  • Monthly downloads: 1.
  • 1 open issue on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require elimuswift/db-exporter
Latest Version:v1.2.5
PHP:>=5.5.9
Laravel:5
Older releases:4
License:MIT
Last Updated:Nov 30, 2021
Links: GitHub  ·  Packagist
Maintainer: weezqyd

Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

Database Exporter

Export your database quickly and easily as a Laravel Migration and all the data as a Seeder class. This can be done via artisan commands or a controller action.

Please note that I've only tested this package on a MySQL database. It has been confirmed it does not work with Postgres

Installation

Add "elimuswift/db-exporter"* as a requirement to composer.json:

{
    "require": {
        "elimuswift/db-exporter": "*"
    },
}

Update composer:

php composer.phar update

For laravel <=5.4, Add the service provider to config/app.php:

 Elimuswift\DbExporter\DbExportHandlerServiceProvider::class

(Optional) Publish the configuration file.

php artisan vendor:publish --provider="Elimuswift\DbExporter\DbExportHandlerServiceProvider"

After publishing the config file make sure you change storage location for migrations and seeds.

Use dev-master as version requirement to be on the cutting edge

Documentation

From the commandline

Export database to migration

Basic usage

php artisan db-exporter:migrations

Specify a database

php artisan db-exporter:migrations otherDatabaseName

Ignoring tables

You can ignore multiple tables by seperating them with a comma.

php artisan db-exporter:migrations --ignore="table1,table2"
Export database table data to seed class

This command will export all your database table data into a seed class.

php artisan db-exporter:seeds

Important: This requires your database config file to be updated in config/database.php**

Uploading migrations/seeds to Storage Disk

Important: The package backup destinations paths should match your desired disk location

You can backup migrations and / or seeds to a storage disk that you application supports.

php artisan db-exporter:backup --migrations

Or upload the seeds to the production server:

php artisan db-exporter:backup --seeds

Or even combine the two:

php artisan db-exporter:backup --migrations --seeds

This feature uses Laravel's filesystem.

You must configure your storage and then specify the disk name in the config file. The default disk is local

Export current database

This class will export the database name from your config/database.php file, based on your 'default' option.

DbExporter::migrate();
Export a custom database
DbExporter::migrate('otherDatabaseName');
Database to seed

This will write a seeder class with all the data of the current database.

DbExporter::seed();
Seed a custom database

Just pass the nameof the database to be seeded.

DbExporter::seed('myOtherDB');

Next all you have to do is add the call method on the base seed class:

$this->call('nameOfYourSeedClass');

Now you can run from the commmand line:

php artisan db:seed, or, without having to add the call method: php artisan db:seed --class=nameOfYourSeedClass

Chaining

You can also combine the generation of the migrations & the seed:

DbExporter::migrate()->seed();

Or with:

DbExporter::migrateAndSeed();
Ignoring tables

By default the migrations table is ignored. You can add tabled to ignore with the following syntax:

DbExporter::ignore('tableToIgnore')->migrateAndSeed();
DbExporter::ignore('table1','table2','table3')->migrateAndSeed();

You can also pass an array of tables to ignore.

From the configuration file

Ignore tables for seeder

If you want to always ignore certain tables you can do it on the config file

return [
    'seeds' => [
        'ignore_tables' => [
            'table_to_ignore1',
            'table_to_ignore2'
        ]
    ]
];

With this configuration every time when the command php artisan db-exporter:seeds is executed will ignore the tables on the array

Just use selected tables for seeder

In the other hand, If you want to use always certain tables you can do it on the config file

return [
    'seeds' => [
        'use_tables' => [
            'table_to_ignore1',
            'table_to_ignore2'
        ]
    ]
];

With this configuration every time when the command php artisan db-exporter:seeds is executed will only be executed to the tables on the array

Credits

Credits to @nWidart the original creator of the package DbExporter. I couldn't get it working as-is, so I decided to rewrite the package to fit the latest versions of laravel, and added a couple a features of my own.

Alternatives to elimuswift/db-exporter

orangehill/iseed

Generate a new Laravel database seed file based on data from the existing databa...

11,704,404 2,894
tomshaw/laravel-calendar-table

A Laravel calendar table database migration and console command.

73,143 8
syamsoul/laravel-set-env

Easily update or insert Laravel environment variable with Artisan command

59,566 9

Version History

Version Released PHP Laravel License
v1.2.5 >=5.5.9 ^5.2 MIT
v1.2.4 >=5.5.9 ^5.2 MIT
v1.2.3 >=5.5.9 ^5.2 MIT
v1.2.2 >=5.5.9 ^5.2 MIT
v1.2.1 >=5.5.9 ^5.2 MIT