springy-framework/installment-calc
Composer 安装命令:
composer require springy-framework/installment-calc
包简介
PHP installment calculator with interest rate
README 文档
README
This class can calculate the amount of installments on loans.
It can take as parameters the loan amount, the interest rate and the identification of the method to use to calculate the installments.
The class can returns the values related with installment payments like the total amount or the interest amount to be returned after a given number of months.
Requirements
- PHP 7.3+
Instalation
To get the latest stable version of this component use:
"require": { "springy-framework/installment-calc": "*" }
in your composer.json file.
Usage
I suppose that the following example is all you need:
<?php require 'vendor/autoload.php'; // If you're using Composer (recommended) // Creates the object. Only the principal value is requered in constructor. $installment = new Springy\InstallmentCalc( 1000, 0.5, Springy\InstallmentCalc::FORMULA_COMPOUND ); /* Interst formula constants explained Springy\InstallmentCalc::FORMULA_SIMPLE - Simple interest Springy\InstallmentCalc::FORMULA_COMPOUND - Compound interest Springy\InstallmentCalc::FORMULA_BCB - Brazilian Central Bank interset formula */ // Gets future amount for 12 months echo $installment->getFutureAmount(12); // Gets total interest for 12 months echo $installment->getInterest(12); // Gets monthly installment for 12 months echo $installment->getMonthlyInstallment(12); // Gets current principal amount echo $installment->getPrincipalAmount(); // Gets current interest formula method echo $installment->getFormulaMethod(); // Gets current interes rate echo $installment->getInterestRate(); // Changes the principal amount value $installment->setPrincipalAmount(1999.99); // Changes the interest formula value $installment->setFormulaMethod(Springy\InstallmentCalc::FORMULA_SIMPLE); // Changes the interest rate value $installment->setInteresRate(1.99);
Contributing
Please read our contributing document and thank you for doing that.
Code of Conduct
In order to ensure that our community is welcoming to all, please review and abide by the code of conduct.
License
This project is licensed under The MIT License (MIT).
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-24