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

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

dilneiss/laravel-migrations-generator
=====================================

Generates Laravel Migrations from an existing database

v5.1.3(4y ago)0556MITPHPPHP &gt;=7.1.3

Since Mar 20Pushed 4y agoCompare

[ Source](https://github.com/dilneiss/laravel-migrations-generator)[ Packagist](https://packagist.org/packages/dilneiss/laravel-migrations-generator)[ Fund](https://www.buymeacoffee.com/kitloong)[ RSS](/packages/dilneiss-laravel-migrations-generator/feed)WikiDiscussions 5.x Synced 3d ago

READMEChangelog (1)Dependencies (6)Versions (26)Used By (0)

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

[](#laravel-migrations-generator)

[![Style check CI](https://github.com/kitloong/laravel-migrations-generator/actions/workflows/check.yml/badge.svg?branch=5.x)](https://github.com/kitloong/laravel-migrations-generator/actions/workflows/check.yml/badge.svg?branch=5.x)[![codecov](https://camo.githubusercontent.com/f5307e7dd85ca4ab592cb4fab73766858375a5673d5f07547d21ff2f50afd87d/68747470733a2f2f636f6465636f762e696f2f67682f6b69746c6f6f6e672f6c61726176656c2d6d6967726174696f6e732d67656e657261746f722f6272616e63682f352e782f67726170682f62616467652e7376673f746f6b656e3d55365a5244505936515a)](https://codecov.io/gh/kitloong/laravel-migrations-generator)[![Tests CI](https://github.com/kitloong/laravel-migrations-generator/actions/workflows/tests.yml/badge.svg?branch=5.x)](https://github.com/kitloong/laravel-migrations-generator/actions/workflows/tests.yml/badge.svg?branch=5.x)[![Latest Stable Version](https://camo.githubusercontent.com/349e298470420306d14c06eb92360778a6d3b46bf590ba05fa98669522bc83fe/68747470733a2f2f706f7365722e707567782e6f72672f6b69746c6f6f6e672f6c61726176656c2d6d6967726174696f6e732d67656e657261746f722f762f737461626c652e706e67)](https://packagist.org/packages/kitloong/laravel-migrations-generator)[![Total Downloads](https://camo.githubusercontent.com/29840d80bc208dbe163ca01d514a58ebb1e36b82564ec46fdb0cfc04d9b33989/687474703a2f2f706f7365722e707567782e6f72672f6b69746c6f6f6e672f6c61726176656c2d6d6967726174696f6e732d67656e657261746f722f646f776e6c6f616473)](https://packagist.org/packages/kitloong/laravel-migrations-generator)[![License](https://camo.githubusercontent.com/25029d7d83da42cc834f1244892b2c6830cee1a87b30bcf42bd38ce0b70f1ef4/68747470733a2f2f706f7365722e707567782e6f72672f6b69746c6f6f6e672f6c61726176656c2d6d6967726174696f6e732d67656e657261746f722f6c6963656e73652e706e67)](https://packagist.org/packages/kitloong/laravel-migrations-generator)

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

This package is cloned from  and updated to support Laravel 5.6 and above, with a lot of feature improvements.

Supported Database
------------------

[](#supported-database)

Currently, Generator support generate migrations from:

- MySQL
- PostgreSQL
- SQL Server

Version Compatibility
---------------------

[](#version-compatibility)

LaravelVersion8.x5.x7.x5.x6.x5.x5.8.x5.x5.7.x5.x5.6.x5.x5.5 and belowInstall
-------

[](#install)

The recommended way to install this is through composer:

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

### Laravel Setup

[](#laravel-setup)

Laravel will automatically register service provider for you.

### Lumen Setup

[](#lumen-setup)

Auto-discovery is not available in Lumen, you need some modification on `bootstrap/app.php`.

#### Enable facade

[](#enable-facade)

Uncomment the following line.

```
$app->withFacades();

```

#### Register provider

[](#register-provider)

Add following line into the `Register Service Providers` section.

```
$app->register(\MigrationsGenerator\MigrationsGeneratorServiceProvider::class);

```

Usage
-----

[](#usage)

To generate migrations from a database, you need to have your database setup in Laravel's config (`config/database.php`).

To create migrations for all the tables, run:

```
php artisan migrate:generate
```

You can specify the tables you wish to generate using:

```
php artisan migrate:generate --tables="table1,table2,table3,table4,table5"
```

You can also ignore tables with:

```
php artisan migrate:generate --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:

```
php artisan migrate:generate --connection="connection_name"
```

### Squash migrations

[](#squash-migrations)

By default, Generator will generate multiple migration files for each table.

You can squash all migrations into a single file with:

```
php artisan migrate:generate --squash
```

### Options

[](#options)

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

OptionsDescription-c, --connection\[=CONNECTION\]The database connection to use-t, --tables\[=TABLES\]A list of Tables or Views you wish to Generate Migrations for separated by a comma: users,posts,comments-i, --ignore\[=IGNORE\]A list of Tables or Views you wish to ignore, separated by a comma: users,posts,comments-p, --path\[=PATH\]Where should the file be created?-tp, --template-path\[=TEMPLATE-PATH\]The location of the template for this generator--date\[=DATE\]Migrations will be created with specified date. Views and Foreign keys will be created with + 1 second. Date should be in format suitable for `Carbon::parse`--table-filename\[=TABLE-FILENAME\]Define table migration filename, default pattern: `[datetime_prefix]\_create_[table]_table.php`--view-filename\[=VIEW-FILENAME\]Define view migration filename, default pattern: `[datetime_prefix]\_create_[table]_view.php`--fk-filename\[=FK-FILENAME\]Define foreign key migration filename, default pattern: `[datetime_prefix]\_add_foreign_keys_to_[table]_table.php`--default-index-namesDon't use db index names for migrations--default-fk-namesDon't use db foreign key names for migrations--use-db-collationFollow db collations for migrations--skip-viewsDon't generate views--squashGenerate all migrations into a single fileThank You
---------

[](#thank-you)

Thanks to Bernhard Breytenbach for his great work. This package is cloned from .

Thanks to Jeffrey Way for his amazing Laravel-4-Generators package. This package depends greatly on his work.

Contributors
------------

[](#contributors)

[![Contributors](https://camo.githubusercontent.com/fc20b24685208b3896d15a670baa513ee24846fb45a2fb25d2b28676c0894962/68747470733a2f2f636f6e747269622e726f636b732f696d6167653f7265706f3d6b69746c6f6f6e672f6c61726176656c2d6d6967726174696f6e732d67656e657261746f72)](https://github.com/kitloong/laravel-migrations-generator/graphs/contributors)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 76.1% 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 ~30 days

Recently: every ~24 days

Total

24

Last Release

1554d ago

Major Versions

3.x-dev → 4.0.02020-04-01

4.x-dev → v5.0.02021-09-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/339a3fb5132ca6fdf590eb87aaf69c97a45b1980dc3bb7109b89b531c56b4d62?d=identicon)[dilneiss](/maintainers/dilneiss)

---

Top Contributors

[![kitloong](https://avatars.githubusercontent.com/u/7660346?v=4)](https://github.com/kitloong "kitloong (363 commits)")[![Xethron](https://avatars.githubusercontent.com/u/1497338?v=4)](https://github.com/Xethron "Xethron (76 commits)")[![tomzx](https://avatars.githubusercontent.com/u/188960?v=4)](https://github.com/tomzx "tomzx (5 commits)")[![acidjazz](https://avatars.githubusercontent.com/u/967369?v=4)](https://github.com/acidjazz "acidjazz (3 commits)")[![shemgp](https://avatars.githubusercontent.com/u/1734126?v=4)](https://github.com/shemgp "shemgp (3 commits)")[![viral-vector](https://avatars.githubusercontent.com/u/20329865?v=4)](https://github.com/viral-vector "viral-vector (3 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![pablorsk](https://avatars.githubusercontent.com/u/938894?v=4)](https://github.com/pablorsk "pablorsk (2 commits)")[![akalongman](https://avatars.githubusercontent.com/u/423050?v=4)](https://github.com/akalongman "akalongman (2 commits)")[![sebdesign](https://avatars.githubusercontent.com/u/667144?v=4)](https://github.com/sebdesign "sebdesign (2 commits)")[![ldebrouwer-rmn](https://avatars.githubusercontent.com/u/6084647?v=4)](https://github.com/ldebrouwer-rmn "ldebrouwer-rmn (2 commits)")[![peeto](https://avatars.githubusercontent.com/u/12824230?v=4)](https://github.com/peeto "peeto (1 commits)")[![Roboroads](https://avatars.githubusercontent.com/u/4398301?v=4)](https://github.com/Roboroads "Roboroads (1 commits)")[![shadywallas](https://avatars.githubusercontent.com/u/1280858?v=4)](https://github.com/shadywallas "shadywallas (1 commits)")[![virtualize](https://avatars.githubusercontent.com/u/220102?v=4)](https://github.com/virtualize "virtualize (1 commits)")[![spescina](https://avatars.githubusercontent.com/u/1956604?v=4)](https://github.com/spescina "spescina (1 commits)")[![TiiFuchs](https://avatars.githubusercontent.com/u/1958744?v=4)](https://github.com/TiiFuchs "TiiFuchs (1 commits)")[![Tucker-Eric](https://avatars.githubusercontent.com/u/6483755?v=4)](https://github.com/Tucker-Eric "Tucker-Eric (1 commits)")[![chrishepner](https://avatars.githubusercontent.com/u/396592?v=4)](https://github.com/chrishepner "chrishepner (1 commits)")[![dilneiss](https://avatars.githubusercontent.com/u/4564667?v=4)](https://github.com/dilneiss "dilneiss (1 commits)")

---

Tags

laravelmigrationgeneratorlumenartisanmigrations

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

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

Generates Laravel Migrations from an existing database

3.3k3.3M25](/packages/xethron-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)

PHPackages © 2026

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