Download the PHP package spaanproductions/laravel-carbon-holidays without Composer
On this page you can find all versions of the php package spaanproductions/laravel-carbon-holidays. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spaanproductions/laravel-carbon-holidays
More information about spaanproductions/laravel-carbon-holidays
Files in spaanproductions/laravel-carbon-holidays
Package laravel-carbon-holidays
Short Description Add Dutch Holidays Check to Carbon in Laravel
License MIT
Homepage https://github.com/spaanproductions/laravel-carbon-holidays
Informations about the package laravel-carbon-holidays
Carbon isHoliday() function to check if the current date is a Holiday
This package can be used to add the isHoliday() function to Carbon. This only checks the Dutch holidays at the moment. We will only check if it's a holiday, not if it's a mandatory free day.
Installation
You can install the package via composer:
It will auto discover in Laravel.
Usage
Check if any holiday
Check specific holidays
You can check for individual holidays using either English or Dutch method names:
Available Methods
All methods work with both Carbon and CarbonImmutable instances.
| Holiday (English) | Holiday (Dutch) | English Method | Dutch Method | Date |
|---|---|---|---|---|
| New Year's Day | Nieuwjaarsdag | isNewYear() |
isNieuwjaarsdag() |
January 1 |
| Good Friday | Goede Vrijdag | isGoodFriday() |
isGoedeVrijdag() |
Friday before Easter |
| Easter Sunday | Paaszondag | isEasterSunday() |
isPaaszondag() |
Calculated |
| Easter Monday | Paasmaandag | isEasterMonday() |
isPaasmaandag() |
Monday after Easter |
| King's Day | Koningsdag | isKingsDay() |
isKoningsdag() |
April 27* |
| Liberation Day | Bevrijdingsdag | isLiberationDay() |
isBevrijdingsdag() |
May 5 |
| Ascension Day | Hemelvaart | isAscensionDay() |
isHemelvaart()† |
Thursday, Easter + 39 days |
| Pentecost | Pinksterzondag | isPentecost()‡ |
isPinksterzondag() |
Sunday, Easter + 49 days |
| Pentecost Monday | Pinkstermaandag | isPentecostMonday()‡ |
isPinkstermaandag() |
Monday, Easter + 50 days |
| Christmas Day | Eerste Kerstdag | isChristmasDay() |
isEersteKerstdag() |
December 25 |
| Boxing Day | Tweede Kerstdag | isBoxingDay() |
isTweedeKerstdag() |
December 26 |
* King's Day is April 26 when April 27 falls on a Sunday
† Also available as isHemelvaartsdag()
‡ Aliases available: isWhitsunday() and isWhitMonday()
Practical Examples
King's Day / Koningsdag
Easter-related holidays
Working with CarbonImmutable
Configuration
Publishing the Config
You can publish the configuration file to customize which holidays are recognized:
This creates config/holidays.php in your application.
Configuration Options
Each holiday can be enabled (true) or disabled (false):
Liberation Day Special Options
Liberation Day supports three configuration modes:
Historically, Liberation Day in the Netherlands was only a public holiday once every 5 years. The 'once-every-5-years' option implements this by checking if the year is divisible by 5.
Important Notes
- Configuration only affects
isHoliday()- The generalisHoliday()method respects your configuration - Individual methods always work - Methods like
isNewYear(),isChristmasDay(), etc. check the actual date regardless of configuration - Example:
This allows you to:
- Control which holidays
isHoliday()recognizes for your application - Still use individual methods to check if a date matches a specific holiday
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Spaan Productions
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.
All versions of laravel-carbon-holidays with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
nesbot/carbon Version ^2.0|^3.0
ext-calendar Version *