PHPackages                             wecansync/laravel-migration-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. wecansync/laravel-migration-generator

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

wecansync/laravel-migration-generator
=====================================

a package to generate migration schema for Models

1.0.4(8mo ago)11.2k↓50%MITPHPPHP ^8.2|^8.3

Since Sep 18Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/wecansync/laravel-migration-generator)[ Packagist](https://packagist.org/packages/wecansync/laravel-migration-generator)[ RSS](/packages/wecansync-laravel-migration-generator/feed)WikiDiscussions main Synced 2d ago

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

Migration files generator
-------------------------

[](#migration-files-generator)

The simplest way to generate schema files like the Doctrine method used in Symfony.

Instead of manually writing migration content using the default Laravel command php artisan make:migration, which only creates the file and requires you to add columns manually, our script simplifies the process. By modifying the attribute values (like type) in your model, the script automatically detects the changes and generates the corresponding migration file for you. This eliminates the need for manual column type changes (e.g., from varchar to text or setting nullable) and streamlines the migration creation process.

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

[](#installation)

```
composer require wecansync/laravel-migration-generator

```

Usage
-----

[](#usage)

### 1. Add the configuration attributes to your Model

[](#1-add-the-configuration-attributes-to-your-model)

```
    // App\Models\Category.php

    /**
     * Configuration for migration schema.
     *
     * @var array
     */
    public $migration_schema = [
        'name' => ['type' => 'string', 'length' => 255, 'nullable' => true],
    ];

```

```

    // App\Models\Brand.php

    /**
     * Configuration for migration schema.
     *
     * @var array
     */
    public $migration_schema = [
        'name' => ['type' => 'string', 'length' => 255, 'nullable' => true],
    ];

```

```

    // App\Models\Tag.php

    /**
     * Configuration for migration schema.
     *
     * @var array
     */
    public $migration_schema = [
        'name' => ['type' => 'string', 'length' => 255, 'nullable' => true],
    ];

```

```
    // App\Models\Product.php

    /**
     * Configuration for migration schema.
     *
     * @var array
     */
    public $migration_schema = [
        'name' => ['type' => 'string', 'length' => 255, 'nullable' => true],
        'description' => ['type' => 'text', 'nullable' => true],
        'price' => ['type' => 'integer', 'nullable' => true],
    ];

    // Define relationships in the model configuration
    public $relationships = [
        // first method (foreign): if you need to specify the foreign field column
        [
            'column' => 'category_id',
            'type' => 'foreign',
            'model' => Category::class, // Related model
            'field' => 'id', // optional: Primary key in the related table (default is 'id')
        ],
        // second method (foreignId): use the id column
        [
            'column' => 'brand_id',
            'type' => 'foreignId',
            'model' => Brand::class, // Related model
        ],
        [
            'type' => 'manyToMany',
            'model' => Tag::class, // Related model
        ]
    ];

```

### 2. Generate migration files for your Model

[](#2-generate-migration-files-for-your-model)

```
php artisan generate:migration Category

```

```
php artisan generate:migration Brand

```

```
php artisan generate:migration Tag

```

```
php artisan generate:migration Product

```

### 3. Migrate

[](#3-migrate)

```
php artisan migrate

```

Default configuration
---------------------

[](#default-configuration)

If you didn't add the configuration array to $migration\_schema, the script will create the default migrations for your fields

```
public $migration_schema = [
// your fields here
'name' => [], // is the array is empty default_schema will be created
];

```

Important
---------

[](#important)

Your $relationships and $migration\_schema attributes should be public in order to be readable by the script.

```
public $migration_schema = [
// your fields here
];

public $relationships = [
// your relations here
];

```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance58

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.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 ~115 days

Total

4

Last Release

268d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/51783676?v=4)[Fouad Salkini](/maintainers/fouadSalkini)[@fouadSalkini](https://github.com/fouadSalkini)

![](https://avatars.githubusercontent.com/u/843926?v=4)[Samer Semaan](/maintainers/icemaker)[@icemaker](https://github.com/icemaker)

![](https://avatars.githubusercontent.com/u/165266973?v=4)[Ebrahim-Hanna-Sync](/maintainers/Ebrahim-Hanna-Sync)[@Ebrahim-Hanna-Sync](https://github.com/Ebrahim-Hanna-Sync)

---

Top Contributors

[![fouadSalkini](https://avatars.githubusercontent.com/u/51783676?v=4)](https://github.com/fouadSalkini "fouadSalkini (37 commits)")[![icemaker](https://avatars.githubusercontent.com/u/843926?v=4)](https://github.com/icemaker "icemaker (3 commits)")[![Ebrahim-Hanna-Sync](https://avatars.githubusercontent.com/u/165266973?v=4)](https://github.com/Ebrahim-Hanna-Sync "Ebrahim-Hanna-Sync (1 commits)")[![RosanaAssy](https://avatars.githubusercontent.com/u/74535876?v=4)](https://github.com/RosanaAssy "RosanaAssy (1 commits)")

### Embed Badge

![Health badge](/badges/wecansync-laravel-migration-generator/health.svg)

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

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[lemaur/eloquent-publishing

218.1k1](/packages/lemaur-eloquent-publishing)[laravel-liberu/laravel-gedcom

A package that converts gedcom files to Eloquent models

782.5k1](/packages/laravel-liberu-laravel-gedcom)

PHPackages © 2026

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