ricardokovalski / interest-calculation
SDK,用于计算利息的规则。
v1.0.2
2021-07-05 20:58 UTC
Requires
- php: >=5.6
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-09-06 04:04:02 UTC
README
这是一个PHP库,包含利息计算的规则。
关于
ricardokovalski/interest-calculation 是一个PHP库,包含简单利息、复合利息和融资计算的规则。
安装
使用 Composer 将此包作为依赖项安装。
composer require ricardokovalski/interest-calculation
基本用法
融资利息
use RicardoKovalski\InterestCalculation\Types\Financial; $interest = new Financial(0.98); // Adiciona um valor ao TotalCapital $interest->appendTotalCapital(227.49); // Adiciona um valor ao InterestValue $interest->appendInterestValue(1.55); // Reseta o valor de TotalCapital para 0.00 $interest->resetTotalCapital(); // Reseta o valor de TotalCapital para 200.00 $interest->resetTotalCapital(200.00); // Reseta o valor de InterestValue para 0.00 $interest->resetInterestValue(); // Reseta o valor de InterestValue para 2.75 $interest->resetInterestValue(2.75); // Obter o valor de TotalCapital $interest->getTotalCapital(); // Obter o valor de InterestValue $interest->getInterestValue(); // Obter o valor de InterestRates $interest->getInterestRates(); // Verifica se o valor de InterestValue está zerado $interest->interestValueIsZeroed(); // Obter valor do juros da 2ª parcela $interest->getValueCalculatedByInstallment(2); // Obter valor do juros reverso da 12ª parcela $interest->getReverseInterestByNumberInstallments(12);
其他类型的利息
对于复合利息,使用 Compound 类。
use RicardoKovalski\InterestCalculation\Types\Compound; $interest = new Compound(3.69);
对于简单利息,使用 Simple 类。
use RicardoKovalski\InterestCalculation\Types\Simple; $interest = new Simple(2.99);
版权和许可证
ricardokovalski/interest-calculation 库版权所有 © Ricardo Kovalski,并按 MIT 许可证(MIT)的条款使用。有关更多信息,请参阅 LICENSE。