PHPackages                             netglue/boe-rates - 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. netglue/boe-rates

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

netglue/boe-rates
=================

Simple utility to download and process historical Bank of England Base Rates

1.0(9y ago)021MITPHPPHP &gt;=7.0CI failing

Since Oct 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/netglue/BoE-Base-Rate-Client)[ Packagist](https://packagist.org/packages/netglue/boe-rates)[ RSS](/packages/netglue-boe-rates/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Bank of England Base Rate Data Client
=====================================

[](#bank-of-england-base-rate-data-client)

This small library retrieves historical bank of england base rate data from the [BoE Website](http://www.bankofengland.co.uk/boeapps/iadb/index.asp?Travel=NIxRPx&From=Repo&C=13T&G0Xtop.x=1&G0Xtop.y=1), parses the returned XML into a data structure and provides some helpful methods to interrogate the data set.

The Rate Service instance accepts an array of rate data in it's constructor that should take the following form:

```
[
    [
        'date' => // DateTime instance
        'rate' => // float
    ],
    // ... more elements
];
```

The Rate Service is an `SplPriorityQueue` instance, so `$rates->top()` will yield the most recent value because elements are inserted with the timestamp as the priority. Being a queue, iterating over it will remove elements, so clone before iterating if you want the data to stick around or use the `$queue->toArray()` method.

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

[](#installation)

```
$ composer require netglue/boe-rates
```

Usage
-----

[](#usage)

### Client `BoeRateClient`

[](#client-boerateclient)

```
use Netglue\Money\BoeRateClient;
$client = new BoeRateClient;
// Optionally set a different endpoint with…
// $client->setUrl('http://somewhere-else.com');
$rates = $client->get();
```

### Service `BoeRateService`

[](#service-boerateservice)

```
use Netglue\Money\BoeRateService;
$service = new BoeRateService($rates);
$first = $service->firstDate();
$last  = $service->lastDate();
$mostRecentRate = $service->getRate();
$date = DateTime::createFromFormat('Y-m-d', '2000-06-01');
$otherRate = $service->getRate($date);

// Iterate over rates: most recent first…

$queue = clone $service;
$queue->setExtractFlags($queue::EXTR_DATA);
foreach ($queue as $data) {
    printf(
        "The BoE base rate changed to %0.2f on %s\n",
        $data['rate'],
        $date['date']->format('l jS F Y')
    );
}

// Serialize to JSON for caching. Date format is optional and defaults to 'c'

$dateFormat = 'd/m/Y';
$json = $service->toJson($dateFormat);

// Initialize service from JSON string
$service = BoeRateService::jsonFactory($json, $dateFormat);
```

About
-----

[](#about)

[Netglue makes web based stuff in Devon, England](https://netglue.uk). We hope this is useful to you and we’d appreciate feedback either way :)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3602d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6c21b0de8cc9938916a186f5f2ed0bee90a4e23e0b29cf7b9c18bfe99067f9b?d=identicon)[netglue](/maintainers/netglue)

---

Top Contributors

[![gsteel](https://avatars.githubusercontent.com/u/2803720?v=4)](https://github.com/gsteel "gsteel (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/netglue-boe-rates/health.svg)

```
[![Health](https://phpackages.com/badges/netglue-boe-rates/health.svg)](https://phpackages.com/packages/netglue-boe-rates)
```

PHPackages © 2026

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