hansott/holidays

This package is abandoned and no longer maintained. No replacement package was suggested.

Returns the holidays for a country

1.0.0 2016-07-23 18:03 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:00:06 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Returns the holidays for a country.

Install

Via Composer

$ composer require hansott/holidays

Supported countries and locales

  • Belgium (BEL)
    • be-nl

Your country and/or locale not in the list? Please see CONTRIBUTING and CONDUCT for details.

Usage

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

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email hansott at hotmail be instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.