PHP code example of kanagama / holidays

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

    

kanagama / holidays example snippets


use Kanagama\Holidays\Holidays;

$holidays = new Holidays();
// true (春分の日)
$holiday = $holidays->checkPublicHoliday(2023, 3, 21);

$holidays = new Holidays();
// 春分の日
$holidayName = $holidays->getPublicHolidayName(2023, 3, 21);

$holidays = new Holidays();
// true (土曜)
$holiday = $holidays->checkHoliday(2023, 3, 19);

$holidays = new Holidays();
// true (翌日が春分の日)
$holiday = $holidays->checkDayBeforePublicHoliday(2023, 3, 20);

$holidays = new Holidays();
// true (前日が春分の日)
$holiday = $holidays->checkDayAfterPublicHoliday(2023, 3, 22);

$holidays = new Holidays();
$holidays->addPublicHoliday(2023, 3, 20, '設立記念日');

# example
$result = Holidays::checkPublicHoliday(2023, 3, 21);
$result = Holidays::getPublicHolidayName(2023, 3, 21);
$result = Holidays::checkHoliday(2023, 3, 21);
$result = Holidays::checkDayBeforePublicHoliday(2023, 3, 21);
$result = Holidays::checkDayAfterPublicHoliday(2023, 3, 21);
$result = Holidays::addPublicHoliday(2023, 3, 20, '設立記念日');