2017 © Pedro Peláez
 

library loan-payments-calculator

PHP library for payment schedule calculations, using various strategies and configurations.

image

vovke/loan-payments-calculator

PHP library for payment schedule calculations, using various strategies and configurations.

  • Thursday, September 7, 2017
  • by Vovke
  • Repository
  • 2 Watchers
  • 8 Stars
  • 100 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 2 Versions
  • 49 % Grown

The README.md

LoanPaymentsCalculator

Build Status Code Coverage Scrutinizer Code Quality, (*1)

LoanPaymentsCalculator is a programmer-oriented library for PHP. It is created to provide Loan Payment Schedules for various inputs and strategies. Mainly developed for the short term loans it can be used for any other loan types as well., (*2)

Installation

You may use Composer to download and install LoanPaymentsCalculator as well as its dependencies., (*3)

$ composer require vovke/loan-payments-calculator

Standards

All the dates meet ISO 8601 standard, Y-m-d (YYYY-MM-DD), (*4)

Components

DateProvider

We use it to provide closest date that suits specific rules, for example, first day of month, not bank holiday and etc., (*5)

``` dateProvider = new DateProvider(DateDetermineStrategy, HolidayProvider, shiftToFuture = true) dateProvider->calculate( startDate ), (*6)


### HolidayProvider an Interface for checking if the specific date is a bank holiday. Used for `period` calculation in `Schedule`. ### Period `Period` class is used to provide an object representing a time frame where needed, it contains start and end date for the specific period and the amount of days between those. We use it as a container to describe the Loan period, where `startDate` is the day when Loan will potentially get issued, and endDate is the date of the last repayment, we also use period for each of the Loan's payments and in that case endDate is the date of the payment's repayment. ### Schedule `Schedule` class is used to generate `periods` for the given loan `period`, number of payments and payment frequency.

$schedule = new Schedule($startDate, $numberOfPeriods, $dateProvider), (*7)


### PaymentScheduleCalculator `PaymentScheduleCalculator` interface is a contract for implementing different ways of payments calculations. #### EqualPrincipalPaymentScheduleCalculator `EqualPrincipalPaymentScheduleCalculator` is the simplest implementation of `PaymentScheduleCalculator` interface, generates payments with equal principal amount.
$startDate = new \DateTime('1984-08-08');
$principalAmount = 500;
$numberOfPeriods = 5;
$dailyInterestRate = 0.000383;
$dateProvider = new DateProvider(new ExactDayOfMonthStrategy(), new WeekendsProvider(), true);
$schedule = new Schedule($startDate, $numberOfPeriods, $dateProvider);
$schedulePeriods = $schedule->generatePeriods();

$paymentSchedule = new EqualPrincipalPaymentScheduleCalculator($schedulePeriods, $principalAmount, $dailyInterestRate);
$payments = $paymentSchedule->calculateSchedule();

#### AnnuityPaymentScheduleCalculator `AnnuityPaymentScheduleCalculator` generates payments with equal payments amount.
...
$paymentSchedule = new AnnuityPaymentScheduleCalculator($schedulePeriods, $principalAmount, $dailyInterestRate);
$payments = $paymentSchedule->calculateSchedule();

```, (*8)

License

Released under the terms of the MIT License., (*9)

The Versions

07/09 2017

dev-master

9999999-dev

PHP library for payment schedule calculations, using various strategies and configurations.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Vova Lando

calculator interest loan annuity

07/09 2017

1.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

by Vova Lando

calculator interest loan annuity