Returns the holidays for a country.
Via Composer
$ composer require hansott/holidays
- Belgium (BEL)
- be-nl
Your country and/or locale not in the list? Please see CONTRIBUTING and CONDUCT for details.
use HansOtt\Holiday\Factory;
use HansOtt\Holiday\Calendar\Year;
$factory = Factory::create();
$calendar = $factory->getCalendar('BEL');
$translator = $factory->getTranslator('BEL', 'nl-be');
$year = Year::current();
// or $year = new Year(2016);
$holidays = $calendar->getHolidays($year);
foreach ($holidays as $holiday) {
$name = $translator->getName($holiday); // string
$startsAt = $holiday->beginsAt(); // DateTimeImmutable
$endsAt = $holiday->endsAt(); // DateTimeImmutable
$formattedTime = $startsAt->format('l j F Y'); // string
echo sprintf('%s -> %s', $name, $formattedTime) . PHP_EOL;
}
Output:
Nieuwjaar -> Friday 1 January 2016
Paasmaandag -> Monday 28 March 2016
Feest Van De Arbeid -> Sunday 1 May 2016
Onze Lieve Heer Hemelvaart -> Monday 11 April 2016
Pinkstermaandag -> Wednesday 18 May 2016
Nationale Feestdag -> Thursday 21 July 2016
Onze Lieve Vrouw Hemelvaart -> Monday 15 August 2016
Allerheiligen -> Tuesday 1 November 2016
Wapenstilstand -> Friday 11 November 2016
Kerstmis -> Sunday 25 December 2016
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email hansott at hotmail be instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.