dfridrich/mortage

Calculate mortage easily in PHP.

v1.0.1 2016-08-01 16:05 UTC

This package is auto-updated.

Last update: 2024-11-06 07:41:13 UTC


README

Build Status Downloads Latest stable

I went by train one day and I wanted to make some cool library, so I did this. Now you can calculate mortage easily in PHP.

Install

composer require dfridrich/mortage

Usage

$mortage = new Defr\MortageRequest(1000000, 1.89, 20);
/** @var \Defr\MortageResult $result */
$result = $mortage->calculate();

You can use MortageResult`s getters for access values:

object(Defr\MortageResult)[2]
  private 'mortageRequest' =>
    object(Defr\MortageRequest)[3]
      private 'salePrice' => float 1000000
      private 'mortgageInterestPercent' => float 1.89
      private 'yearTerm' => int 20
      private 'monthTerm' => int 240
  private 'annualInterestRate' => float 0.0189
  private 'monthlyInterestRate' => float 0.001575
  private 'monthlyPayment' => float 5006.9030574862
  private 'totalPayed' => float 1201656.7337967
  private 'apr' => float 1.91

Credits

Orinally based on library from Dave Tutfs.