Loan to Value (LTV) Calculator for Laravel.
You can install the package via composer:
composer require cyborgfinance/ltv-calculator-laravel
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);
}
}
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
]
$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);
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.