PHPackages                             kostikpenzin/credit-calc - 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. kostikpenzin/credit-calc

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

kostikpenzin/credit-calc
========================

Calculator for calculating the loan repayment schedule using annuity/differentiated repayment methods. You can specify partial early repayment, as well as take into account one-time/periodic commissions. The package is easily expanded with our own algorithms for calculating the repayment schedule.

v0.1.2(3y ago)11.3kMITPHPPHP &gt;=7.4

Since Apr 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kostikpenzin/credit-calc)[ Packagist](https://packagist.org/packages/kostikpenzin/credit-calc)[ RSS](/packages/kostikpenzin-credit-calc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Credit Calculator
=================

[](#credit-calculator)

[![Latest Stable Version](https://camo.githubusercontent.com/3489debf549caefa014b9047e80d9f95bf580556978b8e05daa9d1608063ed86/68747470733a2f2f706f7365722e707567782e6f72672f6b6f7374696b70656e7a696e2f6372656469742d63616c632f762f737461626c65)](https://packagist.org/packages/kostikpenzin/credit-calc)[![Total Downloads](https://camo.githubusercontent.com/4ba22a682360e6a1cc8e8d2438d6a3adf3170088d1c4ed0d8cbdfb3cccb750e1/68747470733a2f2f706f7365722e707567782e6f72672f6b6f7374696b70656e7a696e2f6372656469742d63616c632f646f776e6c6f616473)](https://packagist.org/packages/kostikpenzin/credit-calc)[![Latest Unstable Version](https://camo.githubusercontent.com/70e94443be7e63698540c3b1d21a95368792eed1d777e459ec6c17e892f6b7ae/68747470733a2f2f706f7365722e707567782e6f72672f6b6f7374696b70656e7a696e2f6372656469742d63616c632f762f756e737461626c65)](https://packagist.org/packages/kostikpenzin/credit-calc)[![License](https://camo.githubusercontent.com/b9dab9adebcff17f01ce200d28cd2d596b1c1f27c66226ebfcb84b5310407164/68747470733a2f2f706f7365722e707567782e6f72672f6b6f7374696b70656e7a696e2f6372656469742d63616c632f6c6963656e7365)](https://packagist.org/packages/kostikpenzin/credit-calc)[![Monthly Downloads](https://camo.githubusercontent.com/69db543d35d96f11b440b15cff68c6d6ab5bf55251b53e2485023dde8da31296/68747470733a2f2f706f7365722e707567782e6f72672f6b6f7374696b70656e7a696e2f6372656469742d63616c632f642f6d6f6e74686c79)](https://packagist.org/packages/kostikpenzin/credit-calc)

Calculation of the loan repayment schedule with the possibility of specifying early repayment payments. Both the annuity repayment order and the differentiated one are supported.

All monetary values in the package are integers and represent the sum with cents.

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

[](#installation)

Сomposer: `composer require kostikpenzin/credit-calc`

Using
-----

[](#using)

```
require __DIR__ . '/../vendor/autoload.php';

use CreditCalc\Calculator;
use CreditCalc\CreditParams;
use CreditCalc\UnexpectedPayment;
use CreditCalc\RepaymentSchedule;

$params = new CreditParams(new DateTime('2023-10-31 00:00:00'), 100000000, 990, 12, CreditParams::DURATION_MONTH);
$unexpectedPayments = [
    new UnexpectedPayment(10000000, new DateTime('2023-12-15 00:00:00'), UnexpectedPayment::LESS_PAYMENT),
    new UnexpectedPayment(3565411, new DateTime('2023-01-13 00:00:00'), UnexpectedPayment::LESS_LOAN_PERIOD),
    new UnexpectedPayment(15000000, new DateTime('2023-02-29 00:00:00'), UnexpectedPayment::LESS_LOAN_PERIOD),
];

$calculator = new Calculator;

// we consider the repayment schedule with annuity payments
// So that there are differentiated payments, we specify Calculator::TYPE_DIFFERENTIAL as the third parameter

/** @var RepaymentSchedule $schedule Payment schedule */
$schedule = $calculator->calculate($params, $unexpectedPayments, Calculator::TYPE_ANNUITY);
foreach ($schedule as $repayment) {
    /** @var DateTime $date Date of the next payment period */
    $date = $repayment->getDate()->format('d.m.Y');

    /** @var int $payment The amount of the next payment */
    $payment = $repayment->getPayment();

    /** @var int $percents Interest on the next payment */
    $percents = $repayment->getPercents();

    /** @var int $body The body of the loan for the next payment */
    $body = $repayment->getBody();

    /** @var int $body Loan balance after payment */
    $balance = $repayment->getBalance();
}

/** @var int $total Get the amount of all loan payments */
$total = $schedule->calculateTotalPayments();

/** @var int $overpayment Get the amount of overpayment on the loan */
$overpayment = $schedule->calculateOverpayment();

/** @var int $requestedSum Get the loan amount */
$requestedSum = $schedule->getCreditParams()->getRequestedSum();

/** @var string psk The full cost of the loan as a percentage per annum with rounding up to 3 digits */
$psk = $schedule->calculateTotalCost();
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

1120d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91e9cbcca0b902019fbc065d783f7953d99b744cb4a209e43167be3ba8bf6367?d=identicon)[penzin85](/maintainers/penzin85)

---

Top Contributors

[![kostikpenzin](https://avatars.githubusercontent.com/u/5538990?v=4)](https://github.com/kostikpenzin "kostikpenzin (7 commits)")

---

Tags

calculatorcreditloanannuity paymentdifferential paymentrepayment schedule

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kostikpenzin-credit-calc/health.svg)

```
[![Health](https://phpackages.com/badges/kostikpenzin-credit-calc/health.svg)](https://phpackages.com/packages/kostikpenzin-credit-calc)
```

###  Alternatives

[markrogoyski/ipv4-subnet-calculator

Network calculator for subnet mask and other classless (CIDR) network information.

177813.7k6](/packages/markrogoyski-ipv4-subnet-calculator)[illuminatech/balance

Provides support for Balance accounting system based on debit and credit principle

16137.4k](/packages/illuminatech-balance)[ballen/distical

A distance (Lat/Long) calculation library for PHP

40180.2k2](/packages/ballen-distical)

PHPackages © 2026

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