mhiggster/laravel-mortgage

mortgage-loan

Downloads

221

Stars

13

Version

v0.1.1

LaravelMortgage

Latest Stable Version Total Downloads Latest Unstable Version License

A simple mortgage calculator for Laravel. Laravel-mortgage allows you to calculate the mortgage in two ways:

Annuity

An annuity is a series of payments made at equal intervals. Examples of annuities are regular deposits to a savings account, monthly home mortgage payments, monthly insurance payments and pension payments. Annuities can be classified by the frequency of payment dates.

Differentiated payment

Differentiated payment - this is an unequal monthly tranche proportionally reduced during the loan term. The largest payments - in the fourth quarter. “Median” payments are usually comparable to annuities.

Installation

Install the package through Composer.

Run the Composer require command from the Terminal:

composer require mhiggster/laravel-mortgage

Add a new line to the providers array:

Mortgage\MortgageServiceProvider::class,

And optionally add a new line to the aliases array:

'DifferentiatedPayment' => Mortgage\Facades\DifferentiatedPayment::class,
'Annuity' => Mortgage\Facades\Annuity::class,

And then publish the config file

php artisan vendor:publish --provider="Mortgage\MortgageServiceProvider"

Now you're ready to start using the laravel-mortgage in your application.

Overview

Look at one of the following topics to learn more about LaravelMortgage

Usage

the Mortgage gives you two facades: Annuity and Differentiated These facades gives you the following methods to use:

Annuity::getLoanTerm()

Simple getter which retrieves the loan term. Period for which the debtor must repay the loan

Annuity::getLoanTerm() // 48

Annuity::getLoanAmount()

Simple getter which retrieves the loan amount. The method allows you to find out how much the debtor took a loan

Annuity::getLoanAmount() // 8000000

Annuity::getInterestRate()

Simple getter which retrieves the interest rate. at what interest rate did the lender give a loan

Annuity::getInterestRate() // 18

Annuity::getMainDept()

Simple getter which retrieves the main dept. You can round them as you want

Annuity::getMainDept() // 166666.66666667

Annuity::showRepaymentSchedule()

This method returns a collection, which helps to find out termInMonth, totoalDept, percentDept, mainDept, indebtedness using this data you can build a repayment schedule. an example you can see below

Annuity::showRepaymentSchedule()

Annuity::getPercentAmount()

Amount accrued as a percentage

Annuity::getPercentAmount()

Annuity::effectiveRate()

The effective annual interest rate is the interest rate that is actually earned or paid on an investment.

Annuity::effectiveRate()

Annuity::getTotalamount()

The total amount payable to the debtor

Annuity::getTotalamount()

Annuity::setViscera(48, 8000000, 18)

If you want to use your own data

Annuity::setViscera(48, 8000000, 18)

Similarly, all of these methods are available on the Differentiated facade.

Example

Below is a little example of how to list the cart content in a table:

 // Display the content in a View.
<table>
    <thead>
        <tr>
            <th>Term in month</th>
            <th>Totoal dept</th>
            <th>Percent dept</th>
            <th>Main dept</th>
            <th>Indebtedness</th>
        </tr>
    </thead>

    <tbody>

        @foreach(Annuity::showRepaymentSchedule() as $row)

            <tr>
                <td>{{ termInMonth }}</td>
                <td>{{ totoalDept }}</td>
                <td>{{ percentDept }}</td>
                <td>{{ mainDept }}</td>
                <td>{{ indebtedness }}</td>
            </tr>

        @endforeach

    </tbody>
</table>

Change log

Detailed changes for each release changelog

License

MIT

Copyright (c) 2019-present, Miras Nurmukhanbetov

Mhiggster

Author

Mhiggster