定制 vovke/loan-payments-calculator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vovke/loan-payments-calculator

最新稳定版本:1.0

Composer 安装命令:

composer require vovke/loan-payments-calculator

包简介

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

README 文档

README

Build Status Code Coverage Scrutinizer Code Quality

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.

Installation

You may use Composer to download and install LoanPaymentsCalculator as well as its dependencies.

$ composer require vovke/loan-payments-calculator

Standards

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

Components

DateProvider

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

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

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)

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

License

Released under the terms of the MIT License.

统计信息

  • 总下载量: 6.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 4
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固