PHP code example of fgits / carbon-german-holidays
1. Go to this page and download the library: Download fgits/carbon-german-holidays 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/ */
fgits / carbon-german-holidays example snippets
Fgits\CarbonGermanHolidays\CarbonGermanHolidays;
// Now you can Use CarbonGermanHolidays like Carbon
// eg.: CarbonGermanHolidays::instance() etc.
// Create some instance
$instance1 = CarbonGermanHolidays::createFromDate(2019, 01, 01);
$instance2 = CarbonGermanHolidays::createFromDate(2018, 12, 24);
// Check if the instance is a German Holiday
echo $instance1->isGermanHoliday(); // true
echo $instance2->isGermanHoliday(); // false
echo $instance2->isGermanHoliday(CarbonGermanHolidays::ALL_STATES_ALL_DAYS); // true, cause ALL_STATES_ALL_DAYS
// import class etc, see above.
// Create some instance
$instance1 = CarbonGermanHolidays::createFromDate(2019, 11, 01);
// Check if the instance is a German Holiday
echo $instance1->isGermanHoliday(CarbonGermanHolidays::BRANDENBURG); // true
// Get holiday names for instance
echo $instance1->getGermanHolidaysForDay(CarbonGermanHolidays::BRANDENBURG); // array('Reformationstag')
// import class etc, see above.
// Create some instance
$instance1 = CarbonGermanHolidays::createFromDate(2018, 03, 29); // which is "Gründonnerstag"
// Check if the instance is a German Holiday
echo $instance1->isGermanHoliday(CarbonGermanHolidays::SPECIAL_DAYS_2); // true
// Get holiday names for instance
echo $instance1->getGermanHolidaysForDay(CarbonGermanHolidays::SPECIAL_DAYS_2); // array('Gründonnerstag')
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.