PHPackages                             ksdev/nbp-currency-converter - 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. ksdev/nbp-currency-converter

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

ksdev/nbp-currency-converter
============================

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

0.2.3(10y ago)116.6k1MITPHPPHP &gt;=5.5.0

Since Jul 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ksdev-pl/nbp-currency-converter)[ Packagist](https://packagist.org/packages/ksdev/nbp-currency-converter)[ Docs](https://github.com/ksdev-pl/nbp-currency-converter)[ RSS](/packages/ksdev-nbp-currency-converter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

NBP currency converter
======================

[](#nbp-currency-converter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9a94de65ff94f4247cfdf523f6cc0bc375bf3bb72e27859edf91572f2678b744/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b736465762f6e62702d63757272656e63792d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ksdev/nbp-currency-converter)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b84360875d84d8b541a9fc894bf46a2259129877abcf573db3805f3d8176acd3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6b736465762d706c2f6e62702d63757272656e63792d636f6e7665727465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ksdev-pl/nbp-currency-converter)[![Coverage Status](https://camo.githubusercontent.com/b79518110f2e64a41bf1d1eed280c19dce1b22784368977ca0ac9e63ecd79268/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6b736465762d706c2f6e62702d63757272656e63792d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ksdev-pl/nbp-currency-converter/code-structure)[![Quality Score](https://camo.githubusercontent.com/e49044c4d56b03bccf276ca21ea4fc5e0df9ca10ddac1323687e99977cc5a49d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b736465762d706c2f6e62702d63757272656e63792d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ksdev-pl/nbp-currency-converter)

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

Install
-------

[](#install)

Via Composer

```
$ composer require ksdev/nbp-currency-converter
```

Usage
-----

[](#usage)

If optional table publication date is not passed to `convert` or `averageExchangeRates` methods, the last published average exchange rates table will be used, starting from yesterday, so e.g. on 2015-07-10 (friday) a table from 2015-07-09 (thursday) will be used, and on 2015-07-12 (sunday) a table from 2015-07-10 (friday) - unless no table was published on this day, then the table from previous day will be used, etc.

```
use Ksdev\NBPCurrencyConverter\CurrencyConverter;
use Ksdev\NBPCurrencyConverter\ExRatesTableFinder;
use Ksdev\NBPCurrencyConverter\ExRatesTableFactory;
use GuzzleHttp\Client;

$converter = new CurrencyConverter(
    new ExRatesTableFinder(
        new Client(),
        new ExRatesTableFactory(),
        'path/to/cache/folder'
    )
);
try {
    $result = $converter->convert('123.4567', 'PLN', 'USD');
    $avgExRates = $converter->averageExchangeRates();
}
catch (Exception $e) {
    //
}
```

###### $result

[](#result)

```
array(
    'publication_date' => '2015-07-03',
    'amount'           => '32.7246',
    'currency'         => 'USD'
);
```

###### $avgExRates

[](#avgexrates)

```
array(
    'numer_tabeli'    => '127/A/NBP/2015',
    'data_publikacji' => '2015-07-03',
    'waluty'          =>
        array(
            'PLN' =>
                array(
                    'nazwa_waluty' => 'złoty polski',
                    'przelicznik'  => '1',
                    'kurs_sredni'  => '1',
                ),
            'THB' =>
                array(
                    'nazwa_waluty' => 'bat (Tajlandia)',
                    'przelicznik'  => '1',
                    'kurs_sredni'  => '0,1117',
                ),
            'USD' =>
                array(
                    'nazwa_waluty' => 'dolar amerykański',
                    'przelicznik'  => '1',
                    'kurs_sredni'  => '3,7726',
                ),
            'AUD' =>
                array(...)
        )
);
```

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

Every ~10 days

Total

5

Last Release

3931d ago

### Community

Maintainers

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

---

Top Contributors

[![ksdev-pl](https://avatars.githubusercontent.com/u/4216259?v=4)](https://github.com/ksdev-pl "ksdev-pl (20 commits)")

---

Tags

nbp-currency-converterphpksdevnbp-currency-converter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ksdev-nbp-currency-converter/health.svg)

```
[![Health](https://phpackages.com/badges/ksdev-nbp-currency-converter/health.svg)](https://phpackages.com/packages/ksdev-nbp-currency-converter)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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