artemind / credit-calculator
A simple PHP-based Credit Calculator that supports multiple types of loan payment calculations
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/artemind/credit-calculator
Requires
- php: >=8.2
- spatie/data-transfer-object: ^3.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- pestphp/pest: ^3.2
- phpstan/phpstan: ^1.12
This package is auto-updated.
Last update: 2025-10-15 09:48:08 UTC
README
A simple PHP-based Credit Calculator that supports three types of loan payment calculations:
- Annuity Payments
- Differentiated Payments
- Bullet Payments
Features
- Annuity Calculation: Fixed monthly payments throughout the loan period.
- Differentiated Calculation: Payments decrease over time, starting with higher amounts.
- Bullet Calculation: Payment method where the borrower only pays interest throughout the loan term, and the entire principal is paid in lump sum at the end of loan period.
Requirements
- PHP 8.2 or higher
Installation
composer require artemind/credit-calculator
Usage
use Artemind\CreditCalculator\ResolverFactory; use Artemind\CreditCalculator\Enums\CalculationType; $resolver = ResolverFactory::createResolver(CalculationType::annuity); $paymentSchedule = $resolver->resolve(6, 5000, 45);
Result
{
"total_amount_with_interest":5676,
"total_amount_without_interest":5000,
"schedule":[
{
"month":1,
"principal_payment":759,
"interest_payment":188,
"total_payment":946,
"remaining_principal":4241
},
{
"month":2,
"principal_payment":787,
"interest_payment":159,
"total_payment":946,
"remaining_principal":3454
},
{
"month":3,
"principal_payment":817,
"interest_payment":130,
"total_payment":946,
"remaining_principal":2638
},
{
"month":4,
"principal_payment":847,
"interest_payment":99,
"total_payment":946,
"remaining_principal":1791
},
{
"month":5,
"principal_payment":879,
"interest_payment":67,
"total_payment":946,
"remaining_principal":912
},
{
"month":6,
"principal_payment":912,
"interest_payment":34,
"total_payment":946,
"remaining_principal":0
}
]
}
👨💻 Author
Artem Yeremenko
- Website: artemind.dev
- GitHub: @artemind