PHPackages                             3neti/laravel-model-input - 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. 3neti/laravel-model-input

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

3neti/laravel-model-input
=========================

A package to enable assigning inputs to Eloquent Models

v1.2.0(1w ago)0374↓65.3%2proprietaryPHPPHP ^8.2

Since Mar 26Pushed 4mo agoCompare

[ Source](https://github.com/3neti/laravel-model-input)[ Packagist](https://packagist.org/packages/3neti/laravel-model-input)[ RSS](/packages/3neti-laravel-model-input/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (16)Versions (4)Used By (2)

3neti/laravel-model-input
=========================

[](#3netilaravel-model-input)

A Laravel package that enables **dynamic, validated inputs attached to Eloquent models**.

Features:

- attach arbitrary named inputs to any model (polymorphic)
- enforce validation rules per input type (via enum-driven rules)
- normalize mobile numbers (via laravel-phone)
- dynamic getters/setters via magic accessors
- query models by input (e.g., find by mobile)
- DTO support for structured responses

This package serves as a **flexible input layer** within the x-change ecosystem.

---

✨ Core Concept
--------------

[](#-core-concept)

Instead of adding many columns to a model, you can attach **typed inputs**:

- mobile
- email
- signature
- address
- bank\_account
- etc.

Each input:

- is stored in a separate `inputs` table
- is validated using rules defined per input type
- can be accessed like a normal attribute

---

📦 Installation
--------------

[](#-installation)

```
composer require 3neti/laravel-model-input
```

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish config (optional):

```
php artisan vendor:publish --tag=config
```

---

🧱 Database Migrations
---------------------

[](#-database-migrations)

This package uses:

```
loadMigrationsFrom()
```

Run:

```
php artisan migrate
```

---

🧠 Usage
-------

[](#-usage)

### Add trait to your model

[](#add-trait-to-your-model)

```
use LBHurtado\ModelInput\Traits\HasInputs;

class User extends Model
{
    use HasInputs;
}
```

---

### Set input

[](#set-input)

```
$user->setInput('mobile', '09171234567');
```

or using enum:

```
use LBHurtado\ModelInput\Enums\InputType;

$user->setInput(InputType::MOBILE, '09171234567');
```

---

### Force set (skip validation)

[](#force-set-skip-validation)

```
$user->forceSetInput('mobile', '09171234567');
```

---

### Access input like attribute

[](#access-input-like-attribute)

```
$user->mobile;
$user->signature;
```

---

### Validate input

[](#validate-input)

```
$user->isValidInput('email', 'test@example.com');
```

---

### Query by input

[](#query-by-input)

```
User::findByMobile('09171234567');
User::findByInput('mobile', '09171234567');
```

Supports:

- normalized matching
- partial matching
- flexible formats

---

### Direct access

[](#direct-access)

```
$user->input('mobile');
```

---

📱 Mobile Normalization
----------------------

[](#-mobile-normalization)

Mobile inputs are automatically normalized to:

```
E.164 format (without "+")

```

Examples:

- 0917xxxxxxx
- +63917xxxxxxx
- 63917xxxxxxx

All resolve to the same stored value.

---

🧩 Input Types
-------------

[](#-input-types)

Defined via enum:

```
InputType::MOBILE
InputType::EMAIL
InputType::SIGNATURE
InputType::OTP
...
```

Each input type has validation rules defined in config:

```
model-input.rules.mobile
```

---

🧾 Schema
--------

[](#-schema)

```
inputs
- id
- model_type
- model_id
- name
- value
- timestamps

```

---

🧱 Traits
--------

[](#-traits)

- `HasInputs` → core functionality
- dynamic getters/setters
- validation and normalization

---

🧪 Testing
---------

[](#-testing)

- Testbench
- SQLite in-memory
- test-only migrations under `tests/database/migrations`

---

🧭 Architecture Role
-------------------

[](#-architecture-role)

In x-change ecosystem:

- contact → identity
- model-input → dynamic attributes layer
- cash → value
- voucher → instruction
- wallet → ledger

---

🔒 Design Principles
-------------------

[](#-design-principles)

- avoid schema explosion
- strongly typed inputs via enum
- validation-first design
- flexible querying
- normalization of sensitive fields (e.g., mobile)

---

🚀 Future Enhancements
---------------------

[](#-future-enhancements)

- input history versioning
- encryption support
- indexing optimizations
- event hooks

---

🧾 License
---------

[](#-license)

Proprietary

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance87

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

9d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/586e1ed70140038e6348728222adbcf68bfc4455b1f94a4f8bcbe57917a63d57?d=identicon)[3neti](/maintainers/3neti)

---

Top Contributors

[![3neti](https://avatars.githubusercontent.com/u/89447696?v=4)](https://github.com/3neti "3neti (2 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/3neti-laravel-model-input/health.svg)

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

###  Alternatives

[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.3M27](/packages/yajra-laravel-oci8)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58190.1k19](/packages/api-platform-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[wearepixel/laravel-cart

A cart implementation for Laravel

1394.0k](/packages/wearepixel-laravel-cart)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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