kaurikk/loan-payment-calculator

This package is abandoned and no longer maintained. No replacement package was suggested.

Loan payment calculation library

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

Library to calculate full loan payments (with dates, periods, principal and interest amounts).

Basic usage

// $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);