定制 zzzzzqs/repayment 二次开发

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

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

zzzzzqs/repayment

最新稳定版本:1.0.5

Composer 安装命令:

composer require zzzzzqs/repayment

包简介

laravel package for calculating equal principal interest and equal principal repayment

README 文档

README

Run Tests

A laravel package for calculating equal principal interest and equal principal repayment.

Installation

If you're using Composer to manage dependencies, you can use:

composer require zzzzzqs/repayment

Add service provider

Add the service provider to the providers array in the config/app.php config file as follows:

'providers' => [

    ...

    \Zzzzzqs\Repayment\RepaymentServiceProvider::class,
]

Publish the config

Run the following command to publish the package config file:

php artisan vendor:publish --provider="Zzzzzqs\Repayment\RepaymentServiceProvider"

You should now have a config/repayment.php file that allows you to configure the basics of this package.

Usage

// epc means: matching the principal repayment 
// etc means: average capital plus interest

public function __construct(PaymentCalculatorFactory $calculatorFactory)
{
    $this->calculatorFactory = $calculatorFactory;
}

public function calculate($type, $principal, $interestRate, $years)
{
    $calculator = $this->calculatorFactory->create($type, $principal, $interestRate, $years);
    return $calculator->getResult();
}

// param like this:
// $principal = 120000;
// $yearInterestRate = "0.0486";
// $year = 10;

// the result is a object like RepaymentDTO;
// if you want a array, you can $calculator->getSchedule return the new result like:
[
    1 => [
        "period" => 1
        "principal" => "1000.00"
        "interest" => "486.00"
        "total_money" => "1486.00"
    ],
    2 => [
        "period" => 2
        "principal" => "1000.00"
        "interest" => "481.95"
        "total_money" => "1481.95"
    ],

    ……
]

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-25