kaurikk / loan-payment-period
This package is abandoned and no longer maintained.
No replacement package was suggested.
[Loan payment period calculation library]
0.0.2
2017-04-28 12:18 UTC
Requires
- php: >=7.1
- kaurikk/loan-payment-schedule: >=0.0
Requires (Dev)
- phpunit/phpunit: >=6.0
This package is not auto-updated.
Last update: 2023-04-24 00:22:36 UTC
README
loan-payment-period
Library to generate loan payment periods based on payment schedule. Contains 3 main parts:
- PaymentPeriodsFactory - generates payment periods based on payment schedule
- PaymentPeriods - holds payment periods collection
- Period - single period
Basic usage
See more about PaymentSchedule.
$paymentPeriods = PaymentPeriodsFactory::generate($paymentSchedule); // How many periods are in collection $numberOfPayments = $paymentPeriods->getNoOfPeriods(); // Get array of Periods from collection $periods = $paymentPeriods->getPeriods(); // Get first period from Periods array $firstPeriod = current($periods); // Period start date $firstPeriod->getStart(); // Period end date $firstPeriod->getEnd();
Periods can have two different type of length:
- Average: for monthly payements it's 30
- Exact: exact different between start and end of period (from 28 to 31 or even more is adjusting logic is used)
// How long is period - average (days) $firstPeriod->getAvgLength(); // How long is period - exact (days) $firstPeriod->getExactLength();