PHP code example of azuyalabs / yasumi
1. Go to this page and download the library: Download azuyalabs/yasumi 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/ */
azuyalabs / yasumi example snippets
eate a holiday provider for a specific country and year
$holidays = Yasumi\Yasumi::create('USA', 2026);
// Get all holidays for the year
foreach ($holidays as $holiday) {
echo $holiday->getName() . ': ' . $holiday->format('Y-m-d') . PHP_EOL;
}
// Get a specific holiday
$independenceDay = $holidays->getHoliday('independenceDay');
echo $independenceDay->getName() . ' is on ' . $independenceDay->format('F j, Y') . PHP_EOL;
// Check if a date is a holiday
$newYearsDay = $holidays->getHoliday('newYearsDay');
if ($newYearsDay !== null) {
echo 'New Year\'s Day is a holiday!' . PHP_EOL;
}