Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Library for calculating loan periods (periods between loan payments)

License

Notifications You must be signed in to change notification settings

cookie-devs/loan-payment-period

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

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();

About

Library for calculating loan periods (periods between loan payments)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages