PHPackages                             gibasbr/modelgenerator - 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. gibasbr/modelgenerator

ActiveLibrary

gibasbr/modelgenerator
======================

This package will generate a Laravel Model based on your database table itself, filling in the required fields automatically.

2.3(6y ago)04MITPHP

Since May 27Pushed 6y ago1 watchersCompare

[ Source](https://github.com/gibasbr/modelgenerator)[ Packagist](https://packagist.org/packages/gibasbr/modelgenerator)[ RSS](/packages/gibasbr-modelgenerator/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (15)Used By (0)

Laracademy Generators
=====================

[](#laracademy-generators)

[![Latest Stable Version](https://camo.githubusercontent.com/ecb2d1e59070068ddd901cc338a22729f3ec5da00520f778f1e9461d4fb0d35c/68747470733a2f2f706f7365722e707567782e6f72672f6c617261636164656d792f67656e657261746f72732f762f737461626c65)](https://packagist.org/packages/laracademy/generators) [![Total Downloads](https://camo.githubusercontent.com/d22b5e0bcc6cbcd83ddeb70582bdfb9a5350f93d47cee9ada41a8e41b41a1e34/68747470733a2f2f706f7365722e707567782e6f72672f6c617261636164656d792f67656e657261746f72732f646f776e6c6f616473)](https://packagist.org/packages/laracademy/generators) [![Latest Unstable Version](https://camo.githubusercontent.com/2c7b53cf706196d8fbaded36bfd3c502a6f077e02cc3c63c8606453e8aa7b5d7/68747470733a2f2f706f7365722e707567782e6f72672f6c617261636164656d792f67656e657261746f72732f762f756e737461626c65)](https://packagist.org/packages/laracademy/generators) [![License](https://camo.githubusercontent.com/79e3313fea31ee83c655ed04c3436138495d025cd6e7af0ff6f2e6a08829e67a/68747470733a2f2f706f7365722e707567782e6f72672f6c617261636164656d792f67656e657261746f72732f6c6963656e7365)](https://packagist.org/packages/laracademy/generators)

**Laracademy Generators** - is a tool set that helps speed up the development process of a Laravel application.

**Author(s):**

- [Laracademy](https://laracademy.co) ([@laracademy](http://twitter.com/laracademy), )

Requirements
------------

[](#requirements)

1. PHP 5.6+
2. Laravel 6.\*
3. MySQL \*

\*\* For Laravel 5.\* please use the version 1.5

Usage
-----

[](#usage)

### Step 1: Install through Composer

[](#step-1-install-through-composer)

```
composer require "gibasbr/modelgenerator" --dev

```

### Step 2: Artisan Command

[](#step-2-artisan-command)

Now that we have added the generator to our project the last thing to do is run Laravel's Arisan command

```
php artisan

```

You will see the following in the list

```
generate:modelfromtable

```

Commands
--------

[](#commands)

### generate:modelfromtable

[](#generatemodelfromtable)

This command will read your database table and generate a model based on that table structure. The fillable fields, casts, dates and even namespacing will be filled in automatically.

You can use this command to generate a single table, multiple tables or all of your tables at once.

This command comes with a bunch of different options, please see below for each parameter

- --table=
    - This parameter if filled in will generate a model for the given table.
    - You can also pass in a list of tables using comma separated values.
- --all
    - If this flag is present, then the table command will be ignored.
    - This will generate a model for **all** tables found in your database.
    - *please note that this command will only ignore the `migrations` table and no model will be generate for it*
- --connection=
    - by default if this option is omitted then the generate will use the default connection found in `config/database.php`
    - To specify a connection ensure that it exists in your `config/database.php` first.
- --folder=
    - by default all models are store in your *app/* directory. If you wish to store them in another place you can provide the relative path from your base laravel application.
    - please see examples for more information
- --namespace=
    - by default all models will have the namespace of App
    - you can change the namespace by adding this option
- --debug
    - this shows some more information while running
- --singular
    - this will create a singular titled model
- --softdeletes
- this will include SoftDelete Class on model
- --auditable
- this will include Auditable Class on model (base on git-&gt;)

Examples
--------

[](#examples)

### Generating a single table

[](#generating-a-single-table)

```
php artisan generate:modelfromtable --table=users

```

### Generating a multiple tables

[](#generating-a-multiple-tables)

```
php artisan generate:modelfromtable --table=users,posts

```

### Generating all tables

[](#generating-all-tables)

```
php artisan generate:modelfromtable --all

```

### Changing to another connection found in `database.php` and generating models for all tables

[](#changing-to-another-connection-found-in-databasephp-and-generating-models-for-all-tables)

```
php artisan generate:modelfromtable --connection=spark --all

```

### Changing the folder where to /app/Models

[](#changing-the-folder-where-to-appmodels)

```
php artisan generate:modelfromtable --table=user --folder=app\Models

```

### Add SoftDelete class on model

[](#add-softdelete-class-on-model)

```
php artisan generate:modelfromtable --table=user --softdeletes

```

### Add Auditable class on model

[](#add-auditable-class-on-model)

```
php artisan generate:modelfromtable --table=user --auditable

```

License
-------

[](#license)

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

### Bug Reporting and Feature Requests

[](#bug-reporting-and-feature-requests)

Please add as many details as possible regarding submission of issues and feature requests

### Disclaimer

[](#disclaimer)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~71 days

Total

14

Last Release

2270d ago

Major Versions

1.5 → 2.02019-10-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/8233c0f8cd7411d0ce798d4d668abfc645590c4076883900668ae9f754d9d1ec?d=identicon)[gibasbr](/maintainers/gibasbr)

---

Top Contributors

[![michael-mcmullen](https://avatars.githubusercontent.com/u/811123?v=4)](https://github.com/michael-mcmullen "michael-mcmullen (6 commits)")[![danrovito](https://avatars.githubusercontent.com/u/8322674?v=4)](https://github.com/danrovito "danrovito (5 commits)")[![gibasbr](https://avatars.githubusercontent.com/u/63865077?v=4)](https://github.com/gibasbr "gibasbr (5 commits)")[![mrzainulabideen](https://avatars.githubusercontent.com/u/31840471?v=4)](https://github.com/mrzainulabideen "mrzainulabideen (1 commits)")[![amphetkid](https://avatars.githubusercontent.com/u/675332?v=4)](https://github.com/amphetkid "amphetkid (1 commits)")[![OsamaMohammed](https://avatars.githubusercontent.com/u/19372520?v=4)](https://github.com/OsamaMohammed "OsamaMohammed (1 commits)")[![cyberhicham](https://avatars.githubusercontent.com/u/10002527?v=4)](https://github.com/cyberhicham "cyberhicham (1 commits)")[![mindspread](https://avatars.githubusercontent.com/u/514937?v=4)](https://github.com/mindspread "mindspread (1 commits)")

---

Tags

laravelgenerators

### Embed Badge

![Health badge](/badges/gibasbr-modelgenerator/health.svg)

```
[![Health](https://phpackages.com/badges/gibasbr-modelgenerator/health.svg)](https://phpackages.com/packages/gibasbr-modelgenerator)
```

###  Alternatives

[summerblue/generator

Extend Laravel's generators scaffold.

34139.9k](/packages/summerblue-generator)[zachleigh/laravel-vue-generators

Generate Vue js files via artisan commands.

9039.6k](/packages/zachleigh-laravel-vue-generators)[mckenziearts/laravel-command

A simple Laravel package to provide artisan new commands

321.2k](/packages/mckenziearts-laravel-command)

PHPackages © 2026

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