PHP code example of dfridrich / mortage

1. Go to this page and download the library: Download dfridrich/mortage 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/ */

    

dfridrich / mortage example snippets


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

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