PHPackages                             amranibrahem/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. [Database &amp; ORM](/categories/database)
4. /
5. amranibrahem/laravel-model-generator

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

amranibrahem/laravel-model-generator
====================================

Automatically generate Eloquent models from database tables with professional PHPDoc, relationships, and multi-database support

v2.1.2(5mo ago)021MITPHPPHP ^8.0

Since Nov 24Pushed 5mo agoCompare

[ Source](https://github.com/AmranIbrahem/laravel-model-generator)[ Packagist](https://packagist.org/packages/amranibrahem/laravel-model-generator)[ Docs](https://github.com/amranibrahem/laravel-model-generator)[ RSS](/packages/amranibrahem-laravel-model-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (25)Used By (0)

Laravel Model Generator
=======================

[](#laravel-model-generator)

🚀 **Generate Eloquent Models Automatically from Database Tables**

A powerful Laravel package that automatically generates Eloquent models from your database tables with professional PHPDoc, relationships, and casting.

✨ Features
----------

[](#-features)

- ✅ **Auto-generate Eloquent models** from database tables
- ✅ **Professional PHPDoc** with type hints and relationships
- ✅ **Automatic relationship detection** (hasMany, belongsTo, belongsToMany)
- ✅ **Multi-database support** (MySQL, PostgreSQL, SQLite)
- ✅ **Smart model updating** without overwriting custom code
- ✅ **Custom namespaces and paths**
- ✅ **Beautiful console output** with emojis
- ✅ **Fillable properties &amp; casting** generation
- ✅ **Table name singularization**
- ✅ **Many-to-Many relationships** detection

🚀 Installation
--------------

[](#-installation)

You can install the package via Composer:

```
composer require amranibrahem/laravel-model-generator
```

📖 **Usage**
-----------

[](#-usage)

**1- Generate All Models**

```
php artisan models:generate
```

**2- Generate Specific Tables**

```
php artisan models:generate --tables=users,posts,comments
```

**3- Generate with Relationships**

```
php artisan models:generate --relationships
```

**4- Update Existing Models**

```
php artisan models:generate --force --relationships
```

**5- Custom Path and Namespace**

```
php artisan models:generate --path=app/Domain --namespace=App\\Domain
```

**6- Combine Options**

```
php artisan models:generate --tables=users,posts --relationships --force --path=app/Models
```

🎯 Examples
----------

[](#-examples)

**Generated Model Example**

```
