codesmithtech/amortize

PHP库,用于计算按揭贷款或其他贷款在一定期限内的摊销

0.2.4 2020-03-10 11:36 UTC

This package is auto-updated.

Last update: 2024-09-18 05:43:28 UTC


README

Amortize计算贷款在其整个期限内的摊销,为您处理数学计算。

  • 计算贷款期限中每个月的本金和利息
  • 计算贷款期限内的总偿还额
  • 在期限中途添加部分提前还款,缩短贷款期限,或者重新计算并减少剩余期限的月还款额

安装

composer require codesmithtech/amortize

使用方法

<?php
$amortize = new Amortize();
$amortize->setInterestRate(3.5);
$amortize->setPrincipal(15000.0);
$amortize->setTerm(36); // months

$amortize->totalAmountDueOverTerm(); // returns a float with a value equal to the principal + interest owed over the term of the loan

$amortize->getBreakdownByMonth(); //  returns an array of AmortizedMonth objects, each containing the amount of principal and interest due that month