kaurikk/loan-payment-calculator

此包已被弃用,不再维护。未建议替代包。

贷款还款计算库

0.0.3 2017-04-29 13:19 UTC

This package is not auto-updated.

Last update: 2023-04-29 19:19:26 UTC


README

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

loan-payment-calculator

用于计算完整贷款还款(包括日期、期限、本金和利息金额)的库。

基本用法

// $paymentAmountCalculator is instance of PaymentAmountCalculatorInterface
// $interestAmountCalculator is instance of InterestAmountCalculatorInterface
$calculator = new PaymentsCalculator($paymentAmountCalculator, $interestAmountCalculator);

$periods = $paymentPeriods; // must be instance of PaymentPeriodsInterface
$principal = 2000;
$interestRate = 20;
$calculationMode = 1; // see PaymentPeriodsInterface for available modes
$futureValue = 0; // Expected value after loan end, usually 0 

$payments = $calculator->calculatePayments($periods, $principal, $interestRate, $calculationMode, $futureValue);