PHPackages                             nwidart/db-exporter-l4.0 - 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. nwidart/db-exporter-l4.0

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

nwidart/db-exporter-l4.0
========================

Export your database quickly and easely as a Laravel Migration and all the data as a Seeder class.

0.5(12y ago)515MITPHPPHP &gt;=5.3.0

Since Jan 3Pushed 12y ago1 watchersCompare

[ Source](https://github.com/renege/DbExporter)[ Packagist](https://packagist.org/packages/nwidart/db-exporter-l4.0)[ RSS](/packages/nwidart-db-exporter-l40/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (7)Used By (0)

[![Scrutinizer Quality Score](https://camo.githubusercontent.com/92bc1cd9a6d6eed83ac6b4a36ef31a77f95e130683c349d6323b65de9c2f0b2c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e5769646172742f44624578706f727465722f6261646765732f7175616c6974792d73636f72652e706e673f733d37626432653134636134303937623937396566613164306435353863336165313764643837306266)](https://scrutinizer-ci.com/g/nWidart/DbExporter/)

Database Exporter
=================

[](#database-exporter)

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

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

[](#installation)

Add `"nwidart/db-exporter"`\* as a requirement to `composer.json`:

```
{
    ...
    "require": {
        ...
		"nwidart/db-exporter": "0.5"
    },
}

```

Update composer:

```
$ php composer.phar update

```

Add the service provider to `app/config/app.php`:

```
'Nwidart\DbExporter\DbExportHandlerServiceProvider'

```

(Optional) Publish the configuration file.

```
php artisan config:publish nwidart/db-exporter

```

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

Documentation
-------------

[](#documentation)

### From the commandline

[](#from-the-commandline)

#### Export database to migration

[](#export-database-to-migration)

**Basic usage**

```
php artisan dbe:migrations

```

**Specify a database**

```
php artisan dbe:migrations otherDatabaseName

```

**Ignoring tables**

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

```
php artisan dbe:migrations --ignore="table1,table2"

```

#### Export database table data to seed class

[](#export-database-table-data-to-seed-class)

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

```
php artisan dbe:seeds

```

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

#### Uploading migrations/seeds to remote server

[](#uploading-migrationsseeds-to-remote-server)

**!! Important** \*This requires your app/config/remote.php to be configured. \*

**!! Important** *The package configuration **remote** key needs to be configured to correspond to your remotes directory structure.*

You can with the following command, upload migrations and / or seeds to a remote host with `php artisan dbe:remote remoteName [--migrations] [--seeds]`

For instance **to upload the migrations to the production server:**

```
php artisan dbe:remote production --migrations

```

Or **upload the seeds to the production server:**

```
php artisan dbe:remote production --seeds

```

Or even combine the two:

```
php artisan dbe:remote production --migrations --seeds

```

---

### From a controller / route

[](#from-a-controller--route)

#### Database to migration

[](#database-to-migration)

##### Export current database

[](#export-current-database)

**This requires your database config file to be updated.** The class will export the database name from your `app/config/database.php` file, based on your 'default' option.

Make a export route on your development environment

```

Route::get('export', function()
{
    DbExportHandler::migrate();
});

```

##### Export a custom database

[](#export-a-custom-database)

```

Route::get('export', function()
{
    DbExportHandler::migrate('otherDatabaseName');
});

```

#### Database to seed

[](#database-to-seed)

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

```

Route::get('exportSeed', function()
{
    DbExportHandler::seed();
});

```

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

[](#chaining)

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

```
DbExportHandler::migrate()->seed();

```

Or with:

```
DbExportHandler::migrateAndSeed();

```

**!! Important :** Please note you cannot set a external seed database. If you know of a way to connect to a external DB with laravel without writing in the app/database.php file [let me know](http://www.twitter.com/nicolaswidart).

#### Ignoring tables

[](#ignoring-tables)

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

```
DbExportHandler::ignore('tableToIgnore')->migrate();
DbExportHandler::ignore('tableToIgnore')->seed();

```

You can also send an array of tables to ignore.

TODO
----

[](#todo)

- Export data too. It would be cool if it could also generate a seed file based of the data in the tables. This would be more usefull to run on the production server to get the seed on the development server. **3/1/13**
- Deploy the migration directly to the production server ready to be migrated. (as an option) **5/1/13**
- Make commands to do the same thing (export db to migration) **4/1/13**
- Make commands to do the same thing (export db to seed) **4/1/13**
- Making the upload to remote available directly when generating the migrations/seeds

Credits
-------

[](#credits)

Credits to **@michaeljcalkins** for the [original class](http://paste.laravel.com/1jdw#4) on paste.laravel.com (which goal was to generate migrations from a database). Sadly I couldn't get it working as-is, so I debugged it and decided to make a package out of it, and added a couple a features of my own.

License (MIT)
-------------

[](#license-mit)

Copyright (c) 2013 [Nicolas Widart](http://www.nicolaswidart.com) ,

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.8% 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

5

Last Release

4510d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd10d333ff899865b8dc7eae74b87a20f0599b2490305de3a60fdff749e6cbac?d=identicon)[renege](/maintainers/renege)

---

Top Contributors

[![nWidart](https://avatars.githubusercontent.com/u/882397?v=4)](https://github.com/nWidart "nWidart (28 commits)")[![renege](https://avatars.githubusercontent.com/u/2900069?v=4)](https://github.com/renege "renege (4 commits)")[![codextends](https://avatars.githubusercontent.com/u/3092179?v=4)](https://github.com/codextends "codextends (1 commits)")

---

Tags

phplaraveldatabaseexportartisanmigrationscommandseed

### Embed Badge

![Health badge](/badges/nwidart-db-exporter-l40/health.svg)

```
[![Health](https://phpackages.com/badges/nwidart-db-exporter-l40/health.svg)](https://phpackages.com/packages/nwidart-db-exporter-l40)
```

###  Alternatives

[nwidart/db-exporter

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

37839.1k](/packages/nwidart-db-exporter)[elimuswift/db-exporter

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

364.7k](/packages/elimuswift-db-exporter)[bvanhoekelen/performance

PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.

521774.3k4](/packages/bvanhoekelen-performance)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)

PHPackages © 2026

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