承接 3neti/laravel-model-input 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

3neti/laravel-model-input

Composer 安装命令:

composer require 3neti/laravel-model-input

包简介

A package to enable assigning inputs to Eloquent Models

README 文档

README

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

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

composer require 3neti/laravel-model-input

⚙️ Configuration

Publish config (optional):

php artisan vendor:publish --tag=config

🧱 Database Migrations

This package uses:

loadMigrationsFrom()

Run:

php artisan migrate

🧠 Usage

Add trait to your model

use LBHurtado\ModelInput\Traits\HasInputs;

class User extends Model
{
    use HasInputs;
}

Set input

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

or using enum:

use LBHurtado\ModelInput\Enums\InputType;

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

Force set (skip validation)

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

Access input like attribute

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

Validate input

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

Query by input

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

Supports:

  • normalized matching
  • partial matching
  • flexible formats

Direct access

$user->input('mobile');

📱 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

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

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

🧱 Traits

  • HasInputs → core functionality
  • dynamic getters/setters
  • validation and normalization

🧪 Testing

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

🧭 Architecture Role

In x-change ecosystem:

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

🔒 Design Principles

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

🚀 Future Enhancements

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

🧾 License

Proprietary

3neti/laravel-model-input 适用场景与选型建议

3neti/laravel-model-input 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 66 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 3neti/laravel-model-input 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 3neti/laravel-model-input 我们能提供哪些服务?
定制开发 / 二次开发

基于 3neti/laravel-model-input 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 66
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 29
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-03-26