1. Go to this page and download the library: Download uruba/financalc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uruba / financalc example snippets
// replace the example Composer-bound path with yours
use FinanCalc\Calculators\DebtAmortizator;
use FinanCalc\Utils\Time\TimeUtils;
...
$annuityCalculatorDirect = new DebtAmortizator(
40000,
6,
TimeSpan::asDuration(1),
0.12);
use FinanCalc\FinanCalc;
...
// Instantiation by a factory method
// –
// in our case we calculate a yearly-compounded annuity
// with a duration of 5 periods (here years),
// 100000 money units paid out per period
// and a compounding interest rate of 0.15 (i.e., 15%)
$annuityCalculatorObject = FinanCalc
::getInstance()
->getFactory('AnnuityCalculatorFactory')
->newYearlyAnnuity(
100000,
5,
0.15);
// get the present value of the annuity in arrears
// (as a string)
$PV = $annuityCalculatorObject->getPresentValue(
new AnnuityPaymentTypes(AnnuityPaymentTypes::IN_ARREARS)
);
// get the future value of the annuity in arrears
// (as a string)
$FV = $annuityCalculatorObject->getFutureValue(
new AnnuityPaymentTypes(AnnuityPaymentTypes::IN_ARREARS)
);
use FinanCalc\FinanCalc;
use FinanCalc\Utils\Serializers\XMLSerializer;
...
// Instantiation by a factory method
// –
// in our case we calculate a yearly-compounded annuity
// with a duration of 5 periods (here years),
// 100000 money units paid out per period
// and a compounding interest rate of 0.15 (i.e., 15%)
$annuityCalculatorObject = FinanCalc
::getInstance()
->getFactory('AnnuityCalculatorFactory')
->newYearlyAnnuity(
100000,
5,
0.15);
use FinanCalc\FinanCalc;
...
// Instantiation by a factory method
// –
// in our case we calculate a yearly-compounded annuity
// with a duration of 5 periods (here years),
// 100000 money units paid out per period
// and a compounding interest rate of 0.15 (i.e., 15%)
$annuityCalculatorObject = FinanCalc
::getInstance()
->getFactory('AnnuityCalculatorFactory')
->newYearlyAnnuity(
100000,
5,
0.15);