jn-devops/mortgage
最新稳定版本:v1.2.86
Composer 安装命令:
composer require jn-devops/mortgage
包简介
Homeful Mortgage Package
README 文档
README
This package encapsulates the mortgage loan processing logic of the Homeful platform. It manages everything from borrower evaluation to monthly amortization, income requirements, and cash-out computations. The design is modular, chainable, and test-driven.
Installation
composer require homeful/mortgage
✨ Features Overview
- Encapsulated
MortgageClass: Central to processing and configuring a mortgage loan. - Modular Traits: Responsibilities are split across focused, reusable traits.
- Supports Add-on & Deductible Fees: MRI, Fire Insurance, Consulting, Processing fees, etc.
- Dynamic GMI & PV-based Eligibility: Computes present value from disposable income.
- Test-driven: Includes comprehensive real-world loan scenarios with expected outputs.
- Fluent API: Chainable configuration methods (
setX()->setY()).
🔧 Trait Responsibilities
🔢 Financial Computation
HasContractPrice: Manages TCP (Total Contract Price)HasDownPayment: Computes down payment and amortizationHasMiscellaneousFees: Additional fees (computed or set)HasMultipliers: Interest rates, income multipliersHasTerms: Manages loan balance terms
💸 Cash Flow Management
HasCashOuts: Abstract layer for any outgoing cash itemsHasAddOnFeesToLoanAmortization: Adds MRI & Fire Insurance to monthly amortization
👥 Parties
HasProperty: Assigns & syncsPropertyinstanceHasBorrower: Assigns borrower & GMI rules
🎁 Promotions
HasPromos: Low-cash-out promo logicisPromotional(): Detects promotional packages
⚙️ Static Config
HasConfig: Reads default term, interest rate, borrower age from config
🧮 Computation Flow
- Validation: Inputs validated using Laravel validator
- Defaults: Loaded from
PropertyandBorrowerif not provided - Processing:
- Down Payment
- Balance Payment
- Miscellaneous Fees
- Cash Outs
- Loan Details (term, interest, income requirement)
🔍 Formula Highlights
- Balance Payment = TCP – Down Payment
- Loan Principal = Balance Payment + Balance Misc. Fees
- Loan Amortization = Payment + (MRI + Fire Insurance if applicable)
✅ Eligibility Tools
getLoanDifference(): Checks if borrower can afford based on incomegetPresentValueFromMonthlyDisposableIncomePayments(): PV computation using borrower incomegetJointBorrowerDisposableMonthlyIncome(): Computes combined disposable income
🧪 Test Coverage
Includes over 15 real-world scenarios such as:
- ✅ Agapeya 70/50 Duplex @ 20, 25, and 30 years
- ✅ Ter-Je 2BR 40sqm @ 20, 25, 30 years
- ✅ Low-income housing simulation with ₱750K TCP
- ✅ Relaxed GMI multiplier cases (30% vs 35%)
- ✅ Promo: zero down payment + waived fees
- ✅ Add-on MRI + Fire Insurance added to monthly amortization
- ✅ Present Value edge cases
- ✅ GMI-based maximum loan calculations
- ✅ Full simulation using
createWithTypicalBorrower(...)
Each test checks:
- Down Payment (amount + amortization)
- Balance Payment
- Miscellaneous Fees (partial & full)
- Loan Amount
- Loan Amortization
- GMI / Disposable Income & Present Value eligibility
- Add-on and deductible fee mechanics
- Cash out summaries
- Promo eligibility flags
🧠 Design Insights
- Event Driven: Traits dispatch events on update
- Chainable API: Fluent configuration methods
- Precision Math: Uses
Brick\Money+Whitecube\Price - Compliance Ready: Validates ranges for fees, DP, terms
- Fully Tested: Aligns with
PMT,PVfinancial functions for accuracy
🔗 Key Integrations
Homeful\Payment\Payment: Loan logic & computationHomeful\Property\Property: Provides TCP, MF %, etc.Homeful\Borrower\Borrower: Age, income, regionHomeful\Common\Classes: Shared value object helpers
🧰 Usage
use Homeful\Mortgage\Mortgage; use Homeful\Borrower\Borrower; use Homeful\Property\Property; use Homeful\Common\Classes\Input; use Homeful\Mortgage\Data\MortgageData; use Illuminate\Support\Carbon; use Whitecube\Price\Price; $params = [ Input::WAGES => 50000, Input::TCP => 2500000, Input::PERCENT_DP => 5 / 100, Input::DP_TERM => 12, Input::BP_INTEREST_RATE => 7 / 100, Input::PERCENT_MF => 8.5 / 100, Input::BP_TERM => 20, ]; $property = (new Property) ->setTotalContractPrice(Price::of($params[Input::TCP], 'PHP')) ->setAppraisedValue(Price::of($params[Input::TCP], 'PHP')); $borrower = (new Borrower($property)) ->setBirthdate(Carbon::parse('1999-03-17')) ->setGrossMonthlyIncome($params[Input::WAGES]); $mortgage = new Mortgage(property: $property, borrower: $borrower, params: $params); $data = MortgageData::fromObject($mortgage); dd($data->toArray());
📊 Summary
The Mortgage package serves as the computation core for:
- Housing affordability simulations
- Loan qualification engines
- Down payment amortization planners
- Present value loan caps
- Promotional packages with waived fees
- Cross-segment real estate products
Behold, a new you awaits – with well-structured mortgage processing 🏡✨
jn-devops/mortgage 适用场景与选型建议
jn-devops/mortgage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.1k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「mortgage」 「Homeful」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jn-devops/mortgage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jn-devops/mortgage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jn-devops/mortgage 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Homeful Property Package
Homeful Contacts Package
Homeful Borrower Package
A lightweight, simple and easy PHP library for calculating annuities (e.g., mortgages) according to various input data
Homeful Payment Package
Homeful Products Package
统计信息
- 总下载量: 3.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-01