PHPackages                             itrack/cursbnr - 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. itrack/cursbnr

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

itrack/cursbnr
==============

Librarie PHP pentru preluarea cursului valutar din Romania

v2.0.2(1w ago)4794MITPHPPHP ^7.1 || ^8.0CI passing

Since May 24Pushed 1w ago1 watchersCompare

[ Source](https://github.com/itrack/CursBNR)[ Packagist](https://packagist.org/packages/itrack/cursbnr)[ Docs](https://github.com/itrack/CursBNR)[ RSS](/packages/itrack-cursbnr/feed)WikiDiscussions master Synced 1w ago

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

CursBNR
=======

[](#cursbnr)

[![CI](https://github.com/itrack/CursBNR/actions/workflows/ci.yml/badge.svg)](https://github.com/itrack/CursBNR/actions/workflows/ci.yml)

PHP library for fetching the official exchange rates published by BNR (the National Bank of Romania).

Requirements
------------

[](#requirements)

- PHP 7.1+ (tested up to PHP 8.5)
- the `simplexml` extension

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

[](#installation)

```
composer require itrack/cursbnr
```

Usage
-----

[](#usage)

```
use Itrack\CursBNR\CursBNR;

$curs = new CursBNR(); // downloads https://curs.bnr.ro/nbrfxrates.xml

echo $curs->getCurs('EUR');       // the value as published by BNR, e.g. 4.975
echo $curs->getRate('HUF');       // per-unit rate (takes the multiplier into account)
echo $curs->getMultiplier('HUF'); // 100
echo $curs->getDate();            // publishing date, e.g. 2026-07-21

$curs->hasCurrency('USD');        // true
$curs->getCurrencies();           // ['AED', 'AUD', ... 'EUR', ...]
```

You can also build the object from an already fetched XML document (e.g. from a cache), without any HTTP request:

```
$curs = CursBNR::fromXml($xmlString);
```

Exceptions
----------

[](#exceptions)

All errors throw exceptions from the `Itrack\CursBNR` namespace:

- `CursBNRException` - connection problems or invalid XML response
- `UnknownCurrencyException` - the requested currency is not part of the BNR feed (extends `CursBNRException`)

Both extend `\RuntimeException`, so an existing `catch (\Exception $e)`keeps working.

Tests
-----

[](#tests)

```
composer install
composer test
```

By default the tests run against a local XML fixture, without network access. To also run the live tests against the BNR feed:

```
CURSBNR_NETWORK_TESTS=1 composer test
```

The live tests (`tests/LiveFeedTest.php`) check that the default URL still answers with `200` and XML without redirecting, that the document keeps its structure (`Header/PublishingDate`, `Body/Cube/Rate`, `currency` and `multiplier` attributes), that the publishing date is recent, and that the rates are plausible. They are what tells you BNR moved or changed the feed.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance98

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~1680 days

Total

3

Last Release

10d ago

Major Versions

1.0.2 → v2.0.12026-07-21

PHP version history (2 changes)1.0.2PHP &gt;=5.2.0

v2.0.1PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/59b3256e974f7816de4ef82f232f742e6f1e21517d72539a6f3792311c2eccc0?d=identicon)[itrack](/maintainers/itrack)

---

Top Contributors

[![itrack](https://avatars.githubusercontent.com/u/2368391?v=4)](https://github.com/itrack "itrack (16 commits)")[![tazmanmasters](https://avatars.githubusercontent.com/u/239878399?v=4)](https://github.com/tazmanmasters "tazmanmasters (2 commits)")

---

Tags

exchange ratesbnrcurs valutarcurs bnr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/itrack-cursbnr/health.svg)

```
[![Health](https://phpackages.com/badges/itrack-cursbnr/health.svg)](https://phpackages.com/packages/itrack-cursbnr)
```

###  Alternatives

[florianv/swap

PHP currency conversion library for retrieving exchange rates from 30+ providers, with caching and fallback.

1.3k6.9M25](/packages/florianv-swap)[florianv/laravel-swap

Drop-in Laravel currency conversion: auto-discovered service provider, facade, and config. Multi-provider exchange rates.

3372.3M3](/packages/florianv-laravel-swap)[florianv/exchanger

PHP exchange rate provider layer for currency conversion: 30+ services, chain fallback, and caching.

1865.1M20](/packages/florianv-exchanger)[ujjwal/currency-converter

Currency Converter Class with features of caching and identifying currency from country Code

49231.3k](/packages/ujjwal-currency-converter)

PHPackages © 2026

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