PHP Classes

PHP Installment Payment Calculator: Calculate the amount of installments on loans

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 71 All time: 10,264 This week: 89Up
Version License PHP version Categories
installment-calc 1.0.0MIT/X Consortium ...5PHP 5, Finances
Description 

Author

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.

Picture of Fernando Val
  Performance   Level  
Name: Fernando Val <contact>
Classes: 5 packages by
Country: Brazil Brazil
Age: 56
All time rank: 2326158 in Brazil Brazil
Week rank: 180 Up12 in Brazil Brazil Up

Documentation

PHP Installment Interest and Future Value Calculator

This class can calculate interest, future value, and monthly installment for a principal value with an interest rate for a given number of months.

Latest Stable Version Build Status PHP Composer PHPStan Codacy Badge StyleCI Total Downloads License

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


  Files folder image Files (15)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (1 file)
Files folder imagetests (2 files)
Accessible without login Plain text file .remarkrc Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file codesize.xml Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files (15)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (15)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files (15)  /  src  
File Role Description
  Plain text file InstallmentCalc.php Class Class source

  Files folder image Files (15)  /  tests  
File Role Description
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file installmentTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:71
This week:0
All time:10,264
This week:89Up