PHP code example of ixnode / php-public-holiday

1. Go to this page and download the library: Download ixnode/php-public-holiday 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/ */

    

ixnode / php-public-holiday example snippets


use Ixnode\PhpPublicHoliday\Holiday;

$year = 2024;
$country = \Ixnode\PhpPublicHoliday\Configuration\Country::DE;
$state = \Ixnode\PhpPublicHoliday\Configuration\Country\CountryDe::STATE_SN;

$holiday = new Holiday($year, $country, $state);

print_r($holiday->getHolidays());
// (array) [Ixnode\PhpPublicHoliday\HolidayItem Object, ...]
// - (DateTimeImmutable) ->getDate()
// - (string) ->getName()
bash
composer 
bash
vendor/bin/php-public-holiday -V
bash
php-public-holiday 0.1.0 (2024-07-18 20:33:58) - Björn Hempel <[email protected]>
bash
vendor/bin/php-public-holiday ph DE SN 2024
bash

Country: DE
State:   SN
Year:    2024

- 2024-01-01: Neujahr
- 2024-03-29: Karfreitag
- 2024-03-31: Ostersonntag
- 2024-04-01: Ostermontag
- 2024-05-01: Tag der Arbeit
- 2024-05-09: Christi Himmelfahrt
- 2024-05-19: Pfingstsonntag
- 2024-05-20: Pfingstmontag
- 2024-10-03: Tag der deutschen Einheit
- 2024-12-25: Erster Weihnachtsfeiertag
- 2024-12-26: Zweiter Weihnachtsfeiertag

bash
git clone [email protected]:ixnode/php-public-holiday.git && cd php-public-holiday