PHP code example of kaurikk / loan-payment-period

1. Go to this page and download the library: Download kaurikk/loan-payment-period 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/ */

    

kaurikk / loan-payment-period example snippets


$paymentPeriods = PaymentPeriodsFactory::generate($paymentSchedule);

// How many periods are in collection
$numberOfPayments = $paymentPeriods->getNoOfPeriods();

// Get array of Periods from collection
$periods = $paymentPeriods->getPeriods();


// Get first period from Periods array
$firstPeriod = current($periods);

// Period start date
$firstPeriod->getStart();
// Period end date
$firstPeriod->getEnd();

// How long is period - average (days)
$firstPeriod->getAvgLength();

// How long is period - exact (days)
$firstPeriod->getExactLength();