PHPackages                             farhanisrakyen/laravel-model-bender - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. farhanisrakyen/laravel-model-bender

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

farhanisrakyen/laravel-model-bender
===================================

Interactive Laravel model generator with fields, enums, casts, relationships, and migrations

v1.0.2(1mo ago)034MITPHPPHP &gt;=8.1

Since Jan 24Pushed 3mo agoCompare

[ Source](https://github.com/FarhanIsrakYen/laravel-model-bender)[ Packagist](https://packagist.org/packages/farhanisrakyen/laravel-model-bender)[ RSS](/packages/farhanisrakyen-laravel-model-bender/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (6)Used By (0)

Laravel Model Bender
====================

[](#laravel-model-bender)

An interactive Artisan command to generate and update Laravel models **with fields, casts, relationships, indexes, and migrations** — safely and incrementally.

This package is designed for **real projects**, not just scaffolding demos.

---

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

[](#-features)

- ✅ Interactive CLI wizard
- ✅ Create **models + migrations**
- ✅ Update existing models safely
- ✅ Manage `$fillable`, `$hidden`, `$appends`, `$casts`
- ✅ Relationship generation (incl. morphs)
- ✅ Pivot table generation
- ✅ Index creation with validation
- ✅ Safe alter migrations (no breaking schema)
- ✅ Warnings for duplicates &amp; missing models

---

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

Once the package is published to Packagist, you can install it in your Laravel project:

```
composer require farhanisrakyen/laravel-model-bender
```

### 2. Optional: Publish vendor assets (if applicable)

[](#2-optional-publish-vendor-assets-if-applicable)

```
php artisan vendor:publish --tag=laravel-model-bender
```

### 3. Ensure `app/Models` exists

[](#3-ensure-appmodels-exists)

The package supports nested directories, so make sure your `app/Models` folder exists.

---

Usage
-----

[](#usage)

### Generate a Model Interactively

[](#generate-a-model-interactively)

Run the artisan command with the model name (supports nested paths):

```
php artisan make:model-interactive User
```

or, for nested paths

```
php artisan make:model-interactive Admin/User
```

- This will generate:
    - app/Models/Admin/User.php
    - Migration(s) under database/migrations

🧭 Interactive Flow 1️⃣ Define Fields Once you run the make:model-interactive command, you’ll be prompted for: - Field name - Field type (string, integer, boolean, enum, etc.) - Nullable - Unique - $fillable, $hidden, $appends - $casts

- You will be prompted to **define fields**:

    - Name, type, nullable, unique
    - Add to `$fillable`, `$hidden`, `$appends`
    - Cast type
    - Enum values if field type is `enum`
- Then **define relationships**:

    - Method name
    - Related model (full class or relative)
    - Relationship type (`hasOne`, `hasMany`, `belongsTo`, `belongsToMany`, `morphOne`, `morphMany`, `morphTo`, `morphToMany`)
    - Optionally generate pivot migrations for many-to-many relationships
- After previewing the summary, confirm to generate:

    - Eloquent model file
    - Migration file(s)
    - Pivot migrations (if any)

### Example

[](#example)

```
php artisan make:model-interactive Blog/Post
```

- Creates `app/Models/Blog/Post.php`
- Generates `database/migrations/xxxx_xx_xx_xxxxxx_create_posts_table.php`
- Prompts interactively for fields, enums, casts, and relationships

### Notes

[](#notes)

- Supports nested directories.
- Pivot migrations are automatically created for `belongsToMany` or `morphToMany` relationships.
- `$fillable`, `$casts`, `$hidden`, `$appends`, and `$guarded` are automatically managed.
- Factories are **not** generated.

---

Contributing
------------

[](#contributing)

If you find issues or want to add features, feel free to fork the repository and submit a pull request.

---

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance85

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Total

3

Last Release

48d ago

### Community

Maintainers

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

---

Top Contributors

[![FarhanIsrakYen](https://avatars.githubusercontent.com/u/39534815?v=4)](https://github.com/FarhanIsrakYen "FarhanIsrakYen (47 commits)")

### Embed Badge

![Health badge](/badges/farhanisrakyen-laravel-model-bender/health.svg)

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

###  Alternatives

[crodas/text-rank

Extract relevant keywords from a given text

10458.6k1](/packages/crodas-text-rank)[kunststube/rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

2464.5k3](/packages/kunststube-rison)[evoweb/extender

Extending extbase domain models like a pro with extender

11260.3k6](/packages/evoweb-extender)

PHPackages © 2026

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