Skip to content

Latest commit

 

History

History
111 lines (82 loc) · 2.91 KB

README.md

File metadata and controls

111 lines (82 loc) · 2.91 KB

Loan to Value (LTV) Calculator for Laravel.

Latest Version on Packagist Total Downloads

Loan to Value (LTV) Calculator for Laravel.

Installation

You can install the package via composer:

composer require cyborgfinance/ltv-calculator-laravel

Usage

namespace App\Http\Controllers;

use Cyborgfinance\ltvCalculator\ltvCalculator;

class Testing extends Controller
{

  public function __invoke()
  {

    $ltvCalculator = new ltvCalculator();
    $output = $ltvCalculator->setValue(200)->setDeposit(100)->calculate();

    dd($output);
  }
}

Other Methods

Useing many variations of 2 of the 4 variables (value, deposit, loan, ltv) you can calculate the remaining 2.

//Calculate from Value & Deposit
$ltvCalculator = new ltvCalculator();
$output = $ltvCalculator->setValue(200000)->setDeposit(150000)->calculate();
//Calculate from Value & Loan
$ltvCalculator = new ltvCalculator();
$output = $ltvCalculator->setValue(200000)->setLoan(50000)->calculate();
//Calculate from Value & LTV
$ltvCalculator = new ltvCalculator();
$output = $ltvCalculator->setValue(200000)->setLtv(75)->calculate();
//Calculate from Loan & LTV
$ltvCalculator = new ltvCalculator();
$output = $ltvCalculator->setLoan(5000)->setLtv(75)->calculate();
//Calculate from Deposit & LTV
$ltvCalculator = new ltvCalculator();
$output = $ltvCalculator->setDeposit(50000)->setLtv(75)->calculate();

The output all all of the above examples is:

array:5 [
  "value" => 200000.0
  "deposit" => 150000.0
  "loan" => 50000.0
  "ltv" => 75.0
  "dtv" => 25.0
]

List of Setters

$ltvCalculator = new ltvCalculator();
//List of Setters
//You only need 2 out of 4, to calculate the remaining.
$ltvCalculator->setValue($value);
$ltvCalculator->setDeposit($value);
$ltvCalculator->setLoan($value);
$ltvCalculator->setLtv($value);

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.