cyborgfinance/ltv-calculator-laravel

Loan to Value (LTV) Calculator for Laravel.

1.0.1 2021-04-10 22:38 UTC

This package is auto-updated.

Last update: 2024-11-12 03:21:15 UTC


README

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.