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.1.0(2mo ago)064↓82%2proprietaryPHP

Since Mar 26Pushed 2mo 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 3w ago

READMEChangelog (2)Dependencies (8)Versions (3)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

36

—

LowBetter than 79% of packages

Maintenance85

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Total

2

Last Release

76d 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

### 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

[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

16445.8k](/packages/relaticle-custom-fields)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

244207.7k2](/packages/dragon-code-laravel-deploy-operations)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

8118.0k](/packages/danestves-laravel-polar)[rinvex/laravel-tenants

Rinvex Tenants is a contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.

823.5k10](/packages/rinvex-laravel-tenants)[helgesverre/chromadb

PHP Client for the Chromadb Rest API

321.1k](/packages/helgesverre-chromadb)[helgesverre/milvus

PHP Client for the Milvus Rest API

327.0k](/packages/helgesverre-milvus)

PHPackages © 2026

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