定制 jn-devops/mortgage 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

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 Mortgage Class: 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 amortization
  • HasMiscellaneousFees: Additional fees (computed or set)
  • HasMultipliers: Interest rates, income multipliers
  • HasTerms: Manages loan balance terms

💸 Cash Flow Management

  • HasCashOuts: Abstract layer for any outgoing cash items
  • HasAddOnFeesToLoanAmortization: Adds MRI & Fire Insurance to monthly amortization

👥 Parties

  • HasProperty: Assigns & syncs Property instance
  • HasBorrower: Assigns borrower & GMI rules

🎁 Promotions

  • HasPromos: Low-cash-out promo logic
  • isPromotional(): Detects promotional packages

⚙️ Static Config

  • HasConfig: Reads default term, interest rate, borrower age from config

🧮 Computation Flow

  1. Validation: Inputs validated using Laravel validator
  2. Defaults: Loaded from Property and Borrower if not provided
  3. 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 income
  • getPresentValueFromMonthlyDisposableIncomePayments(): PV computation using borrower income
  • getJointBorrowerDisposableMonthlyIncome(): 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, PV financial functions for accuracy

🔗 Key Integrations

  • Homeful\Payment\Payment: Loan logic & computation
  • Homeful\Property\Property: Provides TCP, MF %, etc.
  • Homeful\Borrower\Borrower: Age, income, region
  • Homeful\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 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 3.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 9
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-01