kaurikk / loan-payment-calculator
Loan payment calculation library
Installs: 501
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 1
pkg:composer/kaurikk/loan-payment-calculator
Requires
- php: >=7.1
- kaurikk/loan-amount-calculator: >=0.0
- kaurikk/loan-payment-period: >=0.0
Requires (Dev)
- phpunit/phpunit: >=6.0
This package is not auto-updated.
Last update: 2023-04-29 19:19:26 UTC
README
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);