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

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

laravel-auto/migrations
=======================

Automatic Laravel model migrations.

1.2.0(5mo ago)02.7k↓53.8%MITPHPPHP &gt;=8.1

Since Feb 15Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/chareka-legacy/laravel-auto-migrations)[ Packagist](https://packagist.org/packages/laravel-auto/migrations)[ RSS](/packages/laravel-auto-migrations/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (9)Dependencies (4)Versions (8)Used By (0)

Laravel Automatic Migrations
============================

[](#laravel-automatic-migrations)

Instead of having to create and manage migration files, this package allows you to specify your migrations inside your model classes via a `migration` method. When you run the `migrate:auto` command, it uses Doctrine to compare your model `migration` methods to the existing schema, and applies the changes automatically.

This package works fine alongside traditional Laravel migration files, for the cases where you still need migrations that are not coupled to a model. When you run the `migrate:auto` command, it will run your traditional migrations first, and the automatic migrations afterwards.

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

[](#documentation)

- [Installation](#installation)
- [Usage](#usage)
- [Commands](#commands)
    - [Making Models](#making-models)
    - [Running Migrations](#running-migrations)
- [Migration Order](#migration-order)
- [Publishing Stubs](#publishing-stubs)

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

[](#installation)

Require the package via composer:

```
composer require laravel-auto/migrations
```

Usage
-----

[](#usage)

Declare a static `migration` method in your models:

```
namespace App\Models;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
   public static function migration(Blueprint $table)
   {
       $table->id();
       $table->string('name');
       $table->timestamp('created_at')->nullable();
       $table->timestamp('updated_at')->nullable();
   }
}
```

Run the `migrate:auto` command:

```
php artisan migrate:auto
```

Commands
--------

[](#commands)

### Making Models

[](#making-models)

Make a model with a `migration` method included:

```
php artisan make:amodel {class} {--force} {--f|no-factory} {--s|no-soft-delete} {--m|no-static-migration}
```

This command will also make a factory whose `definition` points to the model method. Use `--force` to overwrite an existing model.

### Running Migrations

[](#running-migrations)

Run automatic migrations:

```
php artisan migrate:auto {--f|--fresh} {--s|--seed} {--force}
```

Use `-f` to wipe the database, `-s` to seed after migration, and `--force` to run migrations in production.

Migration Order
---------------

[](#migration-order)

You can specify the order to run your model migrations by adding a public `migrationOrder` property to your models. This is useful for pivot tables or situations where you must create a certain table before another.

```
class MyModel extends Model
{
    public $migrationOrder = 1;

    public function migration(Blueprint $table)
    {
        $table->id();
        $table->string('name');
        $table->timestamp('created_at')->nullable();
        $table->timestamp('updated_at')->nullable();
    }
}
```

The `migrate:auto` command will run the automatic migrations in the order specified. If no order is declared for a model, it will default to `0`. Thanks to [@vincentkedison](https://github.com/vincentkedison) for this idea.

Publishing Stubs
----------------

[](#publishing-stubs)

Use your own model and factory stubs by publishing package files:

```
php artisan vendor:publish --tag=laravel-automatic-migrations
```

Update the `stub_path` in `config/auto-migrate.php`:

```
'stub_path' => resource_path('stubs/vendor/laravel-automatic-migrations'),
```

Now edit the stub files inside `resources/stubs/vendor/laravel-automatic-migrations`. Commands will now use these stub files to make models and factories.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance72

Regular maintenance activity

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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 ~58 days

Recently: every ~84 days

Total

7

Last Release

155d ago

### Community

Maintainers

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

---

Top Contributors

[![jcharika](https://avatars.githubusercontent.com/u/42941541?v=4)](https://github.com/jcharika "jcharika (45 commits)")

### Embed Badge

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

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

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M223](/packages/backpack-crud)[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

1.0k2.4M29](/packages/tpetry-laravel-postgresql-enhanced)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k3.5k](/packages/leantime-leantime)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[ronasit/laravel-entity-generator

Provided console command for generating entities.

2053.1k](/packages/ronasit-laravel-entity-generator)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)

PHPackages © 2026

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