PHPackages                             mrcorex/laravel-model-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. mrcorex/laravel-model-generator

ActiveLibrary

mrcorex/laravel-model-generator
===============================

Auto-generate models for a Laravel 5 project.

1.3.3(8y ago)12.2k—0%3MITPHPPHP &gt;=5.5.9

Since Mar 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mrcorex/laravel-model-generator)[ Packagist](https://packagist.org/packages/mrcorex/laravel-model-generator)[ RSS](/packages/mrcorex-laravel-model-generator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (17)Used By (0)

Model generator
===============

[](#model-generator)

Auto-generate models for a Laravel 5 project.

**Note: it is recommended to abandon this package and use corex/lmodel instead. It is more up-to-date and uses doctrine/dbal instead of native sql + other advantages. There are a few changes in configuration but easy to convert config to corex/lmodel.**

**You can continue to use this package. I will do my best to support future versions.**

**Only MySQL will be supported.**

Connects to your existing database and auto-generates models based on existing schema.

- Support for multiple dababases.
- Support for magic properties.
- Support for custom methods.
- Support for guarded fields.
- Support for "extends".
- Support for extra column-attributes after magic properties.
- Support for building constants in model.
- Support for multiple "uses".
- Support for custom "indent".

Installation
============

[](#installation)

Run `"composer require mrcorex/laravel-model-generator"`.

Add a configuration-file called corex and add following code to it. Modify it to suit your needs.

```
return [
    'laravel-model-generator' => [
        'path' => base_path('app/Models'),
        'namespace' => 'App\Models',
        'databaseSubDirectory' => true,
        'extends' => '',
        'indent' => "\t",
        'uses' => [],
        'const' => [
            '{connection}' => [
                '{table}' => [
                    'id' => '{id}',
                    'name' => '{name}',
                    'prefix' => '{prefix}',
                    'suffix' => '{suffix}',
                    'replace' => [
                        'XXXX' => 'YYYY',
                    ]
                ]
            ]
        ]
    ]
];
```

Settings:

- **path** - where models are saved.
- **namespace** - namespace of models.
- **databaseSubDirectory** - true/false if name of database-connection should be applied to namespace/directory. Name will automatically be converted to PascalCase.
- **extends** - (optional) class to extend instead of "Illuminate\\Database\\Eloquent\\Model". Default ''.
- **indent** - (optional) String to use as indent i.e. "\\t". Default 4 spaces.
- **uses** - (optional) List of use's. Warning: it does not clean up old uses, if you change "extends" after model initially was created.
- **const** - (optional) This section is used to specify connections and tables which should contains constants from content of table.
- **{connection}** - (optional) Name of connection.
- **{table}** - (optional) Name of table.
- **{id}** - (required) Name of field to get id from used in constant as value.
- **{name}** - (required) Name of field to get name of constant.
- **{prefix}** - (optional) Prefix to add to each name of constant.
- **{suffix}** - (optional) Suffix to add to each name of constant.
- **replace** - (optional) Values to replace in name of constant.

To register it and make sure you have this option available for development only, add following code to AppServiceProviders@register.

```
public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register('CoRex\Generator\ModelGeneratorProvider');
    }
}
```

Help
====

[](#help)

`php artisan help make:models`

Arguments:

- connection: Name of connection to generate models from. It will be added to namespace/path for separation of models. It is possible to disable this.
- tables: Comma separated table names to generate. Specify "." to generate all.

Options:

- guarded: Comma separated list of guarded fields.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% 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 ~48 days

Recently: every ~149 days

Total

15

Last Release

3031d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a6aef84926b0714b13d3245e2fa5aa650fd48d896936f6f2841e88c0b960780?d=identicon)[mrcorex](/maintainers/mrcorex)

---

Top Contributors

[![corex](https://avatars.githubusercontent.com/u/21259173?v=4)](https://github.com/corex "corex (34 commits)")[![mrcorex](https://avatars.githubusercontent.com/u/570804?v=4)](https://github.com/mrcorex "mrcorex (2 commits)")

---

Tags

laravelgeneratormodelmagic

### Embed Badge

![Health badge](/badges/mrcorex-laravel-model-generator/health.svg)

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

###  Alternatives

[rayvenues/eloquent-model-generator

Eloquent Model Generator

1325.2k1](/packages/rayvenues-eloquent-model-generator)

PHPackages © 2026

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