jn-devops/products
最新稳定版本:v1.4.2
Composer 安装命令:
composer require jn-devops/products
包简介
Homeful Products Package
README 文档
README
This package is part of the Homeful ecosystem and represents a robust Eloquent-based product model for real estate or housing-related systems. It supports a wide range of property and product-related fields and implements the ProductInterface.
📦 Product Model Overview
The Product model captures both core product identity and extended metadata such as property location, pricing, appraisal, and requirements using the SchemalessAttributes via the meta field.
✅ Implements:
ProductInterface- Supports price casting using
Whitecube\Price - Configurable with Laravel's environment and configuration system
🧩 Traits Used
HasAdditionalAttributes
This trait defines metadata-backed accessors/mutators using the SchemalessAttributes package. Key functionalities include:
🔖 Property Metadata Fields
- Basic Fields:
market_segment,location,destinations,directions,amenities,facade_url - Property Info:
project_location,project_code,property_name,phase,block,lot - Dimensions:
lot_area,floor_area,project_address - Structure:
property_type,unit_type,house_type - Financials:
priceappraised_valuepercent_down_paymentdown_payment_termpercent_miscellaneous_feesprocessing_fee
- Loan-Related:
balance_payment_interest_ratebalance_payment_termmortgage_redemption_insurance_feeincome_requirement_multiplierpercent_gross_monthly_income
- Eligibility:
max_agemaximum_paying_age
- Status & Media:
status_codekey_locationdigital_assetsphased_out
Each field is encapsulated via custom getXXXAttribute() and setXXXAttribute() accessors/mutators, backed by JSON metadata.
🏗️ Model Details
Key Properties
| Property | Type | Source |
|---|---|---|
sku |
string | Eloquent |
name |
string | Eloquent |
brand |
string | Eloquent |
category |
string | Eloquent |
description |
string | Eloquent |
price |
Price | casts via PriceCast |
appraised_value |
Price | meta |
percent_down_payment |
float | meta |
down_payment_term |
int | meta |
percent_miscellaneous_fees |
float | meta |
processing_fee |
float | meta or fallback |
phased_out |
bool | meta |
📥 Config Defaults (config/products.php)
return [ 'default' => [ 'processing_fee' => 10000, 'percent_dp' => 0.10, // 10% 'dp_term' => 12, // 12 months 'percent_mf' => 0.085, // 8.5% ], ];
🧪 Tests
Functional Coverage:
- Asserts all core and meta attributes are working as expected
- Verifies casting and type correctness (e.g., Price, float, int, string)
- Confirms that
ProductData::fromModel()transformation works - Tests
updateOrCreate()and interface compliance
expect($product->getAppraisedValue()->equals($product->appraised_value))->toBeTrue(); expect($product->getPercentDownPayment())->toBe($product->percent_down_payment);
🧬 Data Transformation
ProductData
The ProductData class maps the Product model into a normalized, transport-ready DTO using Spatie Laravel Data:
$data = ProductData::fromModel($product);
Provides direct mapping to all relevant fields like:
sku,name,brand,description, etc.- Financial metrics and interest/multiplier values
- Metadata-rich project and unit identifiers
🏁 Conclusion
This package bridges the static nature of database tables and the flexibility needed for real estate product customization. By leveraging SchemalessAttributes, it ensures adaptability without schema bloat.
Behold, a new you awaits — in housing, and in code. 🏡✨
jn-devops/products 适用场景与选型建议
jn-devops/products 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.11k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「products」 「laravel」 「Homeful」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jn-devops/products 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jn-devops/products 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jn-devops/products 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Homeful Property Package
Homeful Contacts Package
Homeful Borrower Package
Homeful Payment Package
Submodule for SilverShop which allows you to compare products in a table.
Homeful Properties Package
统计信息
- 总下载量: 3.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-11