Download the PHP package iamvimukthi/loancalculator without Composer

On this page you can find all versions of the php package iamvimukthi/loancalculator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package loancalculator

Loan Calculator

A Laravel package for calculating loan details, including EMI (Equated Monthly Installment), Total Cost, Total Interest, and generating a detailed Payment Schedule. This package is ideal for financial applications requiring loan calculations.

Features


Installation

Step 1: Install via Composer

Run the installation command:

composer require iamvimukthi/loancalculator:1.0.0

Step 2: (Optional) Publish Configuration

To publish the configuration file (if required):

php artisan vendor:publish --provider="Iamvimukthi\Loancalculator\LoanCalculatorService"

Usage

1. Calculate Loan Details

Use the calculateLoanDetails method to calculate the EMI, total cost, and total interest for a loan.


use Iamvimukthi\Loancalculator\LoanCalculator;

$loanAmount = 500000;  // Principal amount
$annualInterestRate = 5;  // Annual interest rate (percentage)
$loanTermYears = 5;  // Loan term in years
$loanTermMonths = 6;  // Additional months

$loanDetails = LoanCalculator::calculateLoanDetails($loanAmount, $annualInterestRate, $loanTermYears, $loanTermMonths);

echo "Monthly EMI: " . number_format($loanDetails['EMI'], 2) . "\n";
echo "Total Cost of Loan: " . number_format($loanDetails['TotalCost'], 2) . "\n";
echo "Total Interest: " . number_format($loanDetails['TotalInterest'], 2) . "\n";

Output Example:


Monthly EMI: 8,680.78 
Total Cost of Loan: 572,931.50 
Total Interest: 72,931.50

2. Generate Payment Schedule

Use the generatePaymentSchedule method to create a detailed payment schedule for the loan.


$schedule = LoanCalculator::generatePaymentSchedule($loanAmount, $annualInterestRate, $loanTermYears, $loanTermMonths);

foreach ($schedule as $payment) {
    echo "Month-Year: {$payment['MonthYear']}, Principal: " . number_format($payment['PrincipalPayment'], 2) . ", Interest: " . number_format($payment['InterestPayment'], 2) . ", Total: " . number_format($payment['TotalPayment'], 2) . ", Balance: " . number_format($payment['Balance'], 2) . "\n";
}

Output Example:


Month-Year: Dec-2024, Principal: 6,597.45, Interest: 2,083.33, Total: 8,680.78, Balance: 493,402.55
Month-Year: Jan-2025, Principal: 6,624.94, Interest: 2,055.84, Total: 8,680.78, Balance: 486,777.62
...

Methods

calculateLoanDetails($loanAmount, $annualInterestRate, $loanTermYears, $loanTermMonths = 0)

generatePaymentSchedule($loanAmount, $annualInterestRate, $loanTermYears, $loanTermMonths = 0)


Testing

Run unit tests for the package using PHPUnit to ensure calculations are accurate.

php artisan test

Example test case:


use Iamvimukthi\Loancalculator\LoanCalculator;

class LoanCalculatorTest extends TestCase
{
    public function testCalculateLoanDetails()
    {
        $loanDetails = LoanCalculator::calculateLoanDetails(500000, 5, 5, 6);

        $this->assertEquals(9432.26, $loanDetails['EMI']);
        $this->assertEquals(566136.45, $loanDetails['TotalCost']);
        $this->assertEquals(66136.45, $loanDetails['TotalInterest']);
    }
}

License

This package is licensed under the MIT License.

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a Pull Request.

Contact

For any issues or suggestions, please create an issue on the GitHub Issues page.


All versions of loancalculator with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package iamvimukthi/loancalculator contains the following files

Loading the files please wait ...