PHP code example of ricardokovalski / interest-calculation

1. Go to this page and download the library: Download ricardokovalski/interest-calculation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ricardokovalski / interest-calculation example snippets


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

use RicardoKovalski\InterestCalculation\Types\Compound;
  
$interest = new Compound(3.69);

use RicardoKovalski\InterestCalculation\Types\Simple;

$interest = new Simple(2.99);