PHP code example of networkrailbusinesssystems / financial-calendar

1. Go to this page and download the library: Download networkrailbusinesssystems/financial-calendar 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/ */

    

networkrailbusinesssystems / financial-calendar example snippets


$calendar = new FinancialCalendar('2018-05-08');

$calendar = FinancialCalendar::parse('2018-05-08');

$calendar = new FinancialCalendar('01-01-2010', 'm-d-Y');

FinancialCalendar::parse('01-01-2010', 'm-d-Y');

[ year => [month, day] ]

$yearStartOverrides = [
    2017 => [4, 2]
];

$calendar->setYearStartOverrides($yearStartOverrides);

[ year => [week => length] ]

$weekLengthOverrides = [
    2020 => [
        1 => 11
    ]
];

$calendar->setWeekLengthOverrides($weekLengthOverrides);

$calendar
    ->nextPeriod()
    ->nextWeek();

$myModel->forFinancialYear(2001)->get();
$myModel->forFinancialPeriod(2001, 12)->get();