1. Go to this page and download the library: Download twix/carbon 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/ */
twix / carbon example snippets
// Checks if the given date is bank holiday
Carbon::isBankHoliday('2020-05-21'); // true
Carbon::isBankHoliday(Carbon::parse('First day of 2000')); // true
Carbon::getEasterMonday(2021); // '2021-04-05'
Carbon::getWhitMonday(2021); // '2021-05-24'
// Without any parameter will return date for the current year
Carbon::getAscensionThursday(); // '2020-05-21'
// Get all bank holidays for one year
array_map(function (Carbon $carbon): string {
return $carbon->format('Y-m-d');
}, Carbon::getAllBankHolidaysForOneYear(2021));
/*
[
'2021-01-01',
'2021-04-05',
'2021-05-01',
'2021-05-08',
'2021-05-13',
'2021-05-24',
'2021-07-14',
'2021-08-15',
'2021-11-01',
'2021-11-11',
'2021-12-25'
]
*/
docker-compose run --rm php vendor/bin/phpunit
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.