PHPackages                             rapidwebltd/php-uk-bank-holidays - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rapidwebltd/php-uk-bank-holidays

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rapidwebltd/php-uk-bank-holidays
================================

This library enables developers to easily retrieve UK Bank Holiday details. Holidays can be retrieved for England &amp; Wales, Scotland, and Northern Ireland. Information about these holidays can optionally be restricted by month or date.

v5.1.0(1mo ago)12430.3k↓55.4%2LGPL-3.0-onlyPHPPHP &gt;=5.6CI passing

Since Mar 13Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/rapidwebltd/php-uk-bank-holidays)[ Packagist](https://packagist.org/packages/rapidwebltd/php-uk-bank-holidays)[ RSS](/packages/rapidwebltd-php-uk-bank-holidays/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

PHP UK Bank Holidays
====================

[](#php-uk-bank-holidays)

[![Tests](https://github.com/rapidwebltd/php-uk-bank-holidays/actions/workflows/tests.yml/badge.svg)](https://github.com/rapidwebltd/php-uk-bank-holidays/actions/workflows/tests.yml)[![Packagist](https://camo.githubusercontent.com/a156c458418047976a0c896971b164587f08e763434e6f38a2f7677a7acd55d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617069647765626c74642f7068702d756b2d62616e6b2d686f6c69646179732e737667)](https://packagist.org/packages/rapidwebltd/php-uk-bank-holidays/stats)

This library lets developers easily retrieve UK bank holiday details. Holidays can be retrieved for England &amp; Wales, Scotland, and Northern Ireland. Information about these holidays can optionally be restricted by month or date.

Installation
------------

[](#installation)

To install, just run the following composer command.

`composer require rapidwebltd/php-uk-bank-holidays`

Remember to include the `vendor/autoload.php` file if your framework does not do this for you.

Usage
-----

[](#usage)

Retrieving bank holidays for a specific date can be done as follows. By default this will bring back holidays from England &amp; Wales.

```
use RapidWeb\UkBankHolidays\Factories\UkBankHolidayFactory;

$holidays = UkBankHolidayFactory::getByDate(2017, 01, 2);

var_dump($holidays);
```

### UKBankHoliday object

[](#ukbankholiday-object)

All `UkBankHolidayFactory` methods will return an array of `UkBankHoliday` objects. The following snippet shows an example object for the 2017 New Year's Day bank holiday, which occurs on the 2nd of January 2017.

```
array(1) {
  [0]=>
  object(RapidWeb\UkBankHolidays\Objects\UkBankHoliday)#46 (4) {
    ["title"]=>
    string(16) "New Year’s Day"
    ["date"]=>
    string(10) "2017-01-02"
    ["notes"]=>
    string(14) "Substitute day"
  }
}
```

This object contains a title for the holiday, the date it occurs, and government provided notes regarding the holiday, if available. All of these are publicly accessible.

### Location restriction

[](#location-restriction)

If you wish to retrieve bank holidays from Scotland or Northern Ireland, make use of the 4th optional argument, as follows.

```
$englandWalesHolidays = UkBankHolidayFactory::getByDate(2017, 01, 2, 'england-and-wales');
$scotlandHolidays = UkBankHolidayFactory::getByDate(2017, 01, 2, 'scotland');
$northernIrelandHolidays = UkBankHolidayFactory::getByDate(2017, 01, 2, 'northern-ireland');

$allHolidays = array_merge($englandWalesHolidays, $scotlandHolidays, $northernIrelandHolidays);
```

### Custom cache driver

[](#custom-cache-driver)

The default cache driver is selected automatically. You can provide any implementation of `CacheDriverInterface` before retrieving holidays:

```
use RapidWeb\UkBankHolidays\Factories\UkBankHolidayFactory;
use RapidWeb\UkBankHolidays\Interfaces\CacheDriverInterface;

// $yourCacheDriver must implement CacheDriverInterface.
UkBankHolidayFactory::setCacheDriver($yourCacheDriver);
$holidays = UkBankHolidayFactory::getAll();
```

Pass `null` to `setCacheDriver()` to restore automatic cache selection.

### Date-based restrictions

[](#date-based-restrictions)

You can use this library to retrieve all holidays or alternatively holidays restricted by month or date. This is easily done using the `getAll`, `getByMonth` and `getByDate` methods respectively.

See the following examples.

```
$allHolidays = UkBankHolidayFactory::getAll();
$januaryHolidays = UkBankHolidayFactory::getByMonth(2017, 01);
$newYearsHolidays = UkBankHolidayFactory::getByDate(2017, 01, 2);
```

All of these methods accept an additional optional argument to specify the location of the holidays you wish to retrieve. For more details, see the location restriction section above.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance94

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 65.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~244 days

Recently: every ~761 days

Total

15

Last Release

32d ago

Major Versions

v1.0.1 → v2.0.02017-03-27

v2.0.5 → v3.0.02018-01-26

v3.1.2 → v4.0.02018-12-15

v4.0.0 → v5.0.02020-01-11

PHP version history (2 changes)v1.0.0PHP &gt;=5.3

v4.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (15 commits)")[![200MPH](https://avatars.githubusercontent.com/u/16258307?v=4)](https://github.com/200MPH "200MPH (3 commits)")[![ojdon](https://avatars.githubusercontent.com/u/1633249?v=4)](https://github.com/ojdon "ojdon (3 commits)")[![kirsty-gasston](https://avatars.githubusercontent.com/u/12949343?v=4)](https://github.com/kirsty-gasston "kirsty-gasston (2 commits)")

---

Tags

bank-holidaysphp-libraryretrieving-bank-holidaysuk-bank-holidaylibraryPHP Librarybank holidaysuk bank holidaysPHP uk bank holidays library

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rapidwebltd-php-uk-bank-holidays/health.svg)

```
[![Health](https://phpackages.com/badges/rapidwebltd-php-uk-bank-holidays/health.svg)](https://phpackages.com/packages/rapidwebltd-php-uk-bank-holidays)
```

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69939.1M148](/packages/league-iso3166)[niiknow/bayes

a machine learning lib

6958.0k](/packages/niiknow-bayes)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

348.2M4](/packages/dekor-php-array-table)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
