twix / carbon
This is a wrapper for briannesbitt/carbon which also calculates which days are French bank holidays.
1.0.0
2020-06-20 22:32 UTC
Requires
- php: ^7.1
- nesbot/carbon: ^2.35
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2025-06-21 22:34:21 UTC
README
Carbon Support for FR Bank Holidays
This extends Carbon and calculates which days are French bank holidays.
Note: For now, it only supports Carbon v2
Read this in other languages: Français
Installation
composer require twix/carbon
Examples
// 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' ] */
Contributing
- Clone the repo and install dependencies.
docker-compose run --rm php /usr/local/bin/composer install
- Run Tests
docker-compose run --rm php vendor/bin/phpunit