PHPackages                             apxcde/loan-amortization - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. apxcde/loan-amortization

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

apxcde/loan-amortization
========================

PHP composer package for loan amortization

v1.1.0(6mo ago)159[3 PRs](https://github.com/apxcde/loan-amortization/pulls)MITPHPPHP ^8.1CI passing

Since Aug 29Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/apxcde/loan-amortization)[ Packagist](https://packagist.org/packages/apxcde/loan-amortization)[ Docs](https://github.com/apxcde/loan-amortization)[ GitHub Sponsors](https://github.com/apxcde)[ RSS](/packages/apxcde-loan-amortization/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (4)Dependencies (2)Versions (8)Used By (0)

PHP composer package for loan amortization
==========================================

[](#php-composer-package-for-loan-amortization)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a87529c2630e5aa82baa00f532137a5a840ef0cacc4c3c0c9eae0e5250ad6b4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6170786364652f6c6f616e2d616d6f7274697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apxcde/loan-amortization)[![Tests](https://github.com/apxcde/loan-amortization/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/apxcde/loan-amortization/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/50def024fdf0384e0794616d29f26262d658d231e71f5fc6c7e20bbcefd8e3f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6170786364652f6c6f616e2d616d6f7274697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apxcde/loan-amortization)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require apxcde/loan-amortization
```

Usage
-----

[](#usage)

```
use Apxcde\LoanAmortization\LoanAmortization;

$loanAmount = 200000;
$termMonths = 60;
$annualInterestRate = 12;

$loanData = [
    'loan_amount' => $loanAmount,
    'interest' => $annualInterestRate,
    'term_months' => $termMonths,
    'starting_date' => new \DateTime('2024-01-01'),
    'remaining_months' => $termMonths, // Set to $termMonths for new loan, or less if partially paid
];

$loan = new LoanAmortization($loanData);

// Get all results (summary and schedule)
$results = $loan->getResults();

// Access summary
echo "Monthly Payment: $" . number_format($results['summary']['monthly_repayment'], 2) . "\n";
echo "Total Interest: $" . number_format($results['summary']['total_interest'], 2) . "\n";
echo "Total Payment: $" . number_format($results['summary']['total_pay'], 2) . "\n";

// Access payment schedule
foreach ($results['schedule'] as $payment) {
    [$status, $details] = $payment;
    echo sprintf(
        "%s - Date: %s, Payment: $%.2f, Principal: $%.2f, Interest: $%.2f, Balance: $%.2f\n",
        strtoupper($status),
        $details['date'],
        $details['payment'],
        $details['principal'],
        $details['interest'],
        $details['balance']
    );
}
```

### Example with Partial Payment

[](#example-with-partial-payment)

If a loan has already been partially paid:

```
$loanData = [
    'loan_amount' => 200000,
    'interest' => 12,
    'term_months' => 60,
    'starting_date' => new \DateTime('2024-01-01'),
    'remaining_months' => 36, // 24 months already paid, 36 remaining
];

$loan = new LoanAmortization($loanData);
$results = $loan->getResults();

// The schedule will show 24 months as 'paid' and 36 as 'not_paid'
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [ApexCode](https://github.com/apxcde)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance85

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~381 days

Total

4

Last Release

204d ago

Major Versions

v0.0.2 → v1.0.02025-06-22

PHP version history (2 changes)v0.0.1PHP ^8.0

v1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7023a5efc7f59260c31cdb6ac5d2483930a49c6ab56925ded063c37cfb4200f?d=identicon)[apxcde](/maintainers/apxcde)

---

Top Contributors

[![mwamodo](https://avatars.githubusercontent.com/u/52991058?v=4)](https://github.com/mwamodo "mwamodo (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

amortizationcomposer-packageloan-amortizaionapxcdeloan-amortization

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/apxcde-loan-amortization/health.svg)

```
[![Health](https://phpackages.com/badges/apxcde-loan-amortization/health.svg)](https://phpackages.com/packages/apxcde-loan-amortization)
```

###  Alternatives

[spatie/unit-conversions

Perform unit conversions in PHP

363.5k](/packages/spatie-unit-conversions)[devaly/wordpress-routes

Manage rewrites and routes in WordPress with this dead-simple plugin

101.2k](/packages/devaly-wordpress-routes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
