PHPackages                             spacegrass/laravel-migrations-generator - 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. spacegrass/laravel-migrations-generator

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

spacegrass/laravel-migrations-generator
=======================================

Generates Laravel Migrations from an existing database

1.1.1(7y ago)1123MITPHPPHP &gt;=7.0

Since Jun 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/dallincoons/laravel-migrations-generator)[ Packagist](https://packagist.org/packages/spacegrass/laravel-migrations-generator)[ RSS](/packages/spacegrass-laravel-migrations-generator/feed)WikiDiscussions master Synced today

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

Laravel Migrations Generator
============================

[](#laravel-migrations-generator)

Generate Laravel Migrations from an existing database, including indexes and foreign keys!

Laravel 5 installation
----------------------

[](#laravel-5-installation)

The recommended way to install this is through composer:

```
composer require --dev "spacegrass/laravel-migrations-generator"
```

In Laravel 5.5 the service providers will automatically get registered.

In older versions of the framework edit `config/app.php` and add this to providers section:

```
Way\Generators\GeneratorsServiceProvider::class,
Spacegrass\MigrationsGenerator\MigrationsGeneratorServiceProvider::class,
```

If you want this lib only for dev, you can add the following code to your `app/Providers/AppServiceProvider.php` file, within the `register()` method:

```
public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Way\Generators\GeneratorsServiceProvider::class);
        $this->app->register(\Spacegrass\MigrationsGenerator\MigrationsGeneratorServiceProvider::class);
    }
    // ...
}
```

Usage
-----

[](#usage)

To generate migrations from a database, you need to have your database setup in Laravel's Config.

Run `php artisan migrate:generate` to create migrations for all the tables, or you can specify the tables you wish to generate using `php artisan migrate:generate table1,table2,table3,table4,table5`. You can also ignore tables with `--ignore="table3,table4,table5"`

Laravel Migrations Generator will first generate all the tables, columns and indexes, and afterwards setup all the foreign key constraints. So make sure you include all the tables listed in the foreign keys so that they are present when the foreign keys are created.

You can also specify the connection name if you are not using your default connection with `--connection="connection_name"`

Run `php artisan help migrate:generate` for a list of options.

The Laravel Migrations Generator is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

Testing
-------

[](#testing)

To run tests, create a new laravel project locally, ie `laravel new test-migrations-generator`

in the root directory, run `git submodule add https://github.com/dallincoons/laravel-migrations-generator.git package` which will install the package into a direvtory called `package`

in the root directories composer.json file, add

```
"repositories": [
        {
            "type": "path",
            "url": "./package"
        }
    ]
```

and then run `composer require spacegrass/laravel-migrations-generator @dev`

now in config/app.php, add the providers:

```
Way\Generators\GeneratorsServiceProvider::class,
Spacegrass\MigrationsGenerator\MigrationsGeneratorServiceProvider::class,
```

navigate into the `package` directory, composer install, and now you should be able to run the tests: `vendor/bin/phpunit`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

3

Last Release

2887d ago

### Community

Maintainers

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

---

Top Contributors

[![dallincoons](https://avatars.githubusercontent.com/u/6494464?v=4)](https://github.com/dallincoons "dallincoons (8 commits)")

---

Tags

laravelmigrationgeneratorartisanmigrations

### Embed Badge

![Health badge](/badges/spacegrass-laravel-migrations-generator/health.svg)

```
[![Health](https://phpackages.com/badges/spacegrass-laravel-migrations-generator/health.svg)](https://phpackages.com/packages/spacegrass-laravel-migrations-generator)
```

###  Alternatives

[xethron/migrations-generator

Generates Laravel Migrations from an existing database

3.3k3.3M25](/packages/xethron-migrations-generator)[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

2.9k7.4M24](/packages/kitloong-laravel-migrations-generator)[oscarafdev/migrations-generator

Generates Laravel Migrations from an existing database

362585.2k](/packages/oscarafdev-migrations-generator)[daavelar/revengedb

RevengeDb provides an artisan command to make a reverse engineer of the database, generating automatically the migrations for you

193.1k](/packages/daavelar-revengedb)[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)
