Download the PHP package treehousetim/bank-holidays without Composer
On this page you can find all versions of the php package treehousetim/bank-holidays. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download treehousetim/bank-holidays
More information about treehousetim/bank-holidays
Files in treehousetim/bank-holidays
Package bank-holidays
Short Description A simple, zero-dependency, bank holiday calculator for PHP.
License MIT
Informations about the package bank-holidays
bankHolidays
Bank Holiday Date calculations in PHP for United States of America and Canada.
Installing
composer require treehousetim/bank-holidays
Canada
Canadian bank holidays are difficult to find authoritative information for. I've done the best I can with current information. Open an issue if you find authoritative sources of the rules to follow (not just a list of dates).
List of Canadian Bank Holidays
- New Year's Day;
- Family Day;
- Good Friday;
- Easter Monday;
- Victoria Day;
- Canada Day;
- Civic Holiday;
- Labor Day;
- Thanksgiving Day;
- Remembrance Day;
- Christmas Day;
- Boxing Day;
United States
Not all holidays are observed as bank holidays in the United States. If a holiday falls on a Saturday, it is not observed. If it falls on a Sunday it is observed on Monday.
List of US Bank Holidays
- New Year's Day
- Martin Luther King Jr. Day
- Presidents' Day
- Memorial Day
- Juneteenth
- Independence Day
- Labor Day
- Columbus Day
- Veterans Day
- Thanksgiving Day
- Christmas Day
Getting Detail
Both usa
and canada
classes implement the following abstract methods.
The arrays returned by these methods are guaranteed (and enforced by unit tests) to contain the following array keys
country
, observed
, date
, desc
getAsArray()
This will return an array of all holiday date details regardless of whether or not they are observed by that country's banks.
getObservedAsArray()
This will return all observed bank holidays for the year supplied to the library.
get[HolidayName]Detail()
This will return a single holiday's detail array described above.
Output for $year = 2021;
In 2021, Christmas Day is not a bank holiday
Output for $year = 2022;
In 2022, Christmas Day is a bank holiday and is observed on 2022/12/26
General Usage
Testing
If you have cloned this repo, you can run the tests. There are no dependencies, but PHPUnit is installed with composer.
composer install
composer test