Git Product home page Git Product logo

holiday's Introduction

checkdomain Holiday Build Status

Checkdomain/Holiday is a small library to check if a specified date is a holiday in a specific country. It also tells you if the given date is a nation wide holiday or just a holiday in some states.

Currently supported countries

  • 🇦🇹 AT Austria
  • 🇧🇪 BE Belgium
  • 🇧🇷 BR Brazil
  • 🇩🇪 DE Germany
  • 🇩🇰 DK Denmark
  • 🇪🇪 EE Estonia
  • 🇫🇷 FR France
  • 🇭🇺 HU Hungary
  • 🇮🇹 IT Italy
  • 🇱🇹 LT Lithuania
  • 🇱🇺 LU Luxembourg
  • 🇱🇻 LV Latvia
  • 🇳🇴 NO Norway
  • 🇵🇱 PL Poland
  • 🇵🇹 PT Portugal
  • 🇫🇷 RE Réunion
  • 🇷🇴 RO Romania
  • 🇸🇪 SE Sweden

Your country is not supported?

checkdomain Holiday is open source. If you use this library it would be great to get some support for currently not implemented countries which you are familiar with. Pull requests will be reviewed and merged fast.

To create a new Provider please see the ProviderInterface interface.

Requirements

Checkdomain/Holiday requires php >= 5.5.

Installation

The easiest way to install this library is through composer. Just add the following lines to your composer.json file:

{
   "require": {
        "checkdomain/holiday": "~3.0.0"
    }
}

Another way would be to download this library and configure the autoloading yourself. This library relies on a PSR-4 compatible autoloader for automatic class loading.

Usage

To check for holidays just instantiate the Util class and call the getHoliday method.

$util    = new \Checkdomain\Holiday\Util();
$holiday = $util->getHoliday('DE', '2014-01-01');

If you just need to know if there is a holiday on your date there is a isHoliday method, too.

If you need to know all holidays for a specific country you can instantiate one of the included providers yourself and call the getHolidaysByYear method. All providers must follow the ProviderInterface interface.

Running Tests

Run a php composer.phar install command in the base directory to install the phpunit dependency. After that you can simply call php vendor/bin/phpunit to run the test suite.

To run specific test class call php vendor/bin/phpunit --filter TestClassName

holiday's People

Contributors

agilov avatar benjaminpaap avatar cmyker avatar danubio avatar floriankoerner avatar garak avatar giorrrgio avatar hanzi avatar ickbinhier avatar jostbaron avatar jul6art avatar kristianlunde avatar martinlindhe avatar mpociot avatar vincenttouzet avatar wandersonwhcr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

holiday's Issues

Tag a release?

Hello, could you please tag a release from this repository. It is useful so composer dont have to look for latest version every time one do "composer update", and so forth. :-)

/m

I18n Support

Hello!

I just found your repository after thinking about a class that I developed 5 years ago with Zend_Date and holidays.

Reading your code, I just realized that you don't have a I18n support. So, if I code...

$util->isHoliday('PT', '25/12/2017');
// Exception: DateTime::__construct(): Failed to parse time string (25/12/2017) at position 0 (2): Unexpected character

I want to add this new feature. Do you have any suggestion before I begin?

After that, I'll add a new provider for Brazilian holidays.

Thank you!

Increase minimum PHP version

Since a break (with major version release) has been already proposed in #39, it would be nice to increase minimum PHP version, avoiding getting stuck with unsupported third-parties libraries (like phpunit).
I see two possibilities:

  1. a soft break. Increase min. PHP to 5.6. Pro: more conservative. Con: cannot exploiit new language features, problem will arise again in a short timeframe
  2. an hard break. Increase min. PHP to 7.1. Pro: can exploit new language features, will be OK for a while. Con: less conservative

I'm more for option 2, considering that PHP 5.6 is already out of active support and will be out of security support in a few weeks

Reformationstag in 2017 will be legally observed in all German states

I noticed that wikipedia has the following to say about Reformationstag (Reformation Day) in 2017:

Im Jahr 2017, dem 500. Jahr des Beginns der Reformation, ist der 31. Oktober einmalig ein gesamtdeutscher gesetzlicher Feiertag.[10] Dazu haben alle Bundesländer, in denen der Reformationstag normalerweise kein Feiertag ist, Gesetze bzw. Verordnungen erlassen, die den 31. Oktober 2017 zum Feiertag erklären: Baden-Württemberg,[11] Bayern,[12] Berlin,[13] Bremen,[14] Hamburg,[15] Hessen,[16] Niedersachsen,[17] Nordrhein-Westfalen,[18] Rheinland-Pfalz,[19] Saarland[20] und Schleswig-Holstein.[21]

Roughly, as 2017 is the 500th anniversay of the Reformation, the federal states which do not normally observe it as a holiday have declared a one day legal holiday in 2017 only.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.