/loan-payment-calculator

Library for calculation full loan payments (principal, interest)

Primary LanguagePHPMIT LicenseMIT

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 insance 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

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