PHP code example of jn-devops / mortgage

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

    

jn-devops / mortgage example snippets


use Homeful\Mortgage\Mortgage;
use Homeful\Borrower\Borrower;
use Homeful\Property\Property;
use Homeful\Common\Classes\Input;
use Homeful\Mortgage\Data\MortgageData;
use Illuminate\Support\Carbon;
use Whitecube\Price\Price;

$params = [
    Input::WAGES => 50000,
    Input::TCP => 2500000,
    Input::PERCENT_DP => 5 / 100,
    Input::DP_TERM => 12,
    Input::BP_INTEREST_RATE => 7 / 100,
    Input::PERCENT_MF => 8.5 / 100,
    Input::BP_TERM => 20,
];

$property = (new Property)
    ->setTotalContractPrice(Price::of($params[Input::TCP], 'PHP'))
    ->setAppraisedValue(Price::of($params[Input::TCP], 'PHP'));

$borrower = (new Borrower($property))
    ->setBirthdate(Carbon::parse('1999-03-17'))
    ->setGrossMonthlyIncome($params[Input::WAGES]);

$mortgage = new Mortgage(property: $property, borrower: $borrower, params: $params);
$data = MortgageData::fromObject($mortgage);

dd($data->toArray());