承接 zwei/loan-calculator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

zwei/loan-calculator

Composer 安装命令:

composer require zwei/loan-calculator

包简介

The loan calculator package.

README 文档

README

贷款计算器, 生成还款和回款计划, 支持任意精度的数字

支持还款方式

还款方式 是否支持
等额本金 支持
等额本息 支持
每月还息到期还本 支持
一次性还本付息 支持

安装前准备

  1. php5.4以上版本
  2. bcmath扩展 http://php.net/manual/zh/book.bc.php
  3. 创建composer.json文件,并写入以下内容:
{
  "require": {
    "zwei/loan-calculator": "dev-master"
  }
}
  1. 执行composer install

计算器

使用示例(use)

  1. 例如项目目录在"E:\web\php7\test"
  2. 创建index.php,并加入以下内容
<?php
include_once 'vendor/autoload.php';

use Zwei\LoanCalculator\Calculator\EqualTotalPaymentCalculator;
use Zwei\LoanCalculator\Calculator\EqualPrincipalPaymentCalculator;
use Zwei\LoanCalculator\Calculator\MonthlyInterestPaymentCalculator;
use Zwei\LoanCalculator\Calculator\OncePayPrincipalInterestPaymentCalculator;
use \Zwei\LoanCalculator\PaymentCalculatorFactory;

$principal          = 50000;// 本金
$yearInterestRate   = "0.10";// 年利率10%
$months             = 12;// 借款12个月
$time               = strtotime("2018-03-20 10:05");// 借款时间
$decimalDigits      = 2;// 保留小数点后3位,默认保留2位

// 等额本金计算器
$obj = PaymentCalculatorFactory::getPaymentCalculatorObj(PaymentCalculatorFactory::TYPE_EQUAL_PRINCIPAL, $principal, $yearInterestRate, $month, 0);
$lists = $obj->getPlanLists();
print_r($lists);

// 等额本息计算器
$obj = PaymentCalculatorFactory::getPaymentCalculatorObj(PaymentCalculatorFactory::TYPE_EQUAL_TOTAL_PAYMENT, $principal, $yearInterestRate, $month, 0);
$lists = $obj->getPlanLists();
print_r($lists);

// 每月还息到期还本还款方式计算器
$obj = PaymentCalculatorFactory::getPaymentCalculatorObj(PaymentCalculatorFactory::TYPE_MONTHLY_INTEREST, $principal, $yearInterestRate, $month, 0);
$lists = $obj->getPlanLists();
print_r($lists);

// 一次性还本付息还款方式计算器
$obj = PaymentCalculatorFactory::getPaymentCalculatorObj(PaymentCalculatorFactory::TYPE_ONCE_PAY_PRINCIPAL_INTEREST, $principal, $yearInterestRate, $month, 0);
$lists = $obj->getPlanLists();
print_r($lists);

// 等额本金计算器
$obj                = new EqualPrincipalPaymentCalculator($principal, $yearInterestRate, $months, $time, $decimalDigits);
$planLists          = $obj->getPlanLists();// 获取还款计划
// 等额本息计算器
$obj                = new EqualTotalPaymentCalculator($principal, $yearInterestRate, $months, $time, $decimalDigits);
$planLists          = $obj->getPlanLists();// 获取还款计划
// 每月还息到期还本还款方式计算器
$obj                = new MonthlyInterestPaymentCalculator($principal, $yearInterestRate, $months, $time, $decimalDigits);
$planLists          = $obj->getPlanLists();// 获取还款计划
// 一次性还本付息还款方式计算器
$obj                = new OncePayPrincipalInterestPaymentCalculator($principal, $yearInterestRate, $months, $time, $decimalDigits);
$planLists          = $obj->getPlanLists();// 获取还款计划

单元测试使用

--bootstrap 在测试前先运行一个 "bootstrap" PHP 文件

  • --bootstrap引导测试: phpunit --bootstrap ./Tests/TestInit.php ./Tests/

D:\phpStudy\php\php-7.1.13-nts\php.exe D:\phpStudy\php\php-5.6.27-nts\composer.phar update

D:\phpStudy\php\php-7.1.13-nts\php.exe vendor\phpunit\phpunit\phpunit --bootstrap tests/TestInit.php tests/

zwei/loan-calculator 适用场景与选型建议

zwei/loan-calculator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 181 次下载、GitHub Stars 达 13, 最近一次更新时间为 2018 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 zwei/loan-calculator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zwei/loan-calculator 我们能提供哪些服务?
定制开发 / 二次开发

基于 zwei/loan-calculator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-13