PHP code example of luedtke / laravel-holiday-facade
1. Go to this page and download the library: Download luedtke/laravel-holiday-facade 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/ */
use Laravel\Holiday\Facades\Holiday;
// Is a date a public holiday?
Holiday::isHoliday('2026-12-25'); // true
Holiday::isHoliday('2026-12-24'); // false — Christmas Eve is an observance
Holiday::isHoliday('2026-12-24', strict: false); // true — ay::previous('2026-01-10')->name; // "Neujahr"
// Next workday
Holiday::nextWorkday('2026-12-24'); // Carbon instance for 2026-12-28
// Get all holidays for a year
Holiday::getHolidays(2026); // Collection of Holiday objects
// Get holidays in a date range
Holiday::getHolidaysBetween('2026-04-01', '2026-04-30');
// Count holidays
Holiday::countHolidays(2026); // int
// Look up a holiday by date
Holiday::getHoliday('2026-12-25'); // Holiday value object
// Check by name
Holiday::isHolidayByName('Neujahr', 2026); // true
// Only holidays that apply to Bavaria (BY)
Holiday::getHolidays(2026, state: 'BY');
// Heilige Drei Könige applies to BY, BW, ST — not to HH
Holiday::isHolidayByName('Heilige Drei Könige', state: 'BY'); // true
Holiday::isHolidayByName('Heilige Drei Könige', state: 'HH'); // false
// Get the list of supported state codes
Holiday::supportedRegions(); // ['BW', 'BY', 'BE', ...]