PHPackages                             steffenbrand/curr-curr - 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. steffenbrand/curr-curr

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

steffenbrand/curr-curr
======================

Delivers current exchange rates for EUR provided by the ECB as PHP objects.

4.1.0(4y ago)87.5k↓33.3%11UnlicensePHPPHP ^7.3 || ^8.0

Since Feb 23Pushed 4y ago2 watchersCompare

[ Source](https://github.com/steffenbrand/curr-curr)[ Packagist](https://packagist.org/packages/steffenbrand/curr-curr)[ Docs](https://github.com/steffenbrand/curr-curr)[ RSS](/packages/steffenbrand-curr-curr/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (1)

CurrCurr - Current Currency (Exchange Rates)
============================================

[](#currcurr---current-currency-exchange-rates)

[![Build](https://camo.githubusercontent.com/5f2824954c63703d068f9be0f04907b413deca76182bec22a930320de40bcc68/68747470733a2f2f7472617669732d63692e6f72672f7374656666656e6272616e642f637572722d637572722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/steffenbrand/curr-curr)[![Coverage](https://camo.githubusercontent.com/8d8108d836ae1c265008ba068316608469fd3b5fe9efe643fcdd2beabd5b0ffa/68747470733a2f2f636f6465636f762e696f2f6769746875622f7374656666656e6272616e642f637572722d637572722f636f7665726167652e737667)](https://codecov.io/gh/steffenbrand/curr-curr)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8995a9f81e41fee89965a4636684ff4584786bb6c000226a9c44de666e3811c5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7374656666656e6272616e642f637572722d637572722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/steffenbrand/curr-curr/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/12d60cd269db81403972d20af47f88317550ef44373d6c01d35e1b9a27576f8d/68747470733a2f2f706f7365722e707567782e6f72672f7374656666656e6272616e642f637572722d637572722f76657273696f6e)](https://packagist.org/packages/steffenbrand/curr-curr)[![Latest Unstable Version](https://camo.githubusercontent.com/97cc5c94a797a348088ef3d59aa9aa9ae1cffc8afe096adc11414f67ba0d1614/68747470733a2f2f706f7365722e707567782e6f72672f7374656666656e6272616e642f637572722d637572722f762f756e737461626c65)](//packagist.org/packages/steffenbrand/curr-curr)[![Total Downloads](https://camo.githubusercontent.com/54cb56be87f36d61fa2b3cd9a7b2488f34f991009e708b99a90ebfac7c6a0aac/68747470733a2f2f706f7365722e707567782e6f72672f7374656666656e6272616e642f637572722d637572722f646f776e6c6f616473)](https://packagist.org/packages/steffenbrand/curr-curr)[![License](https://camo.githubusercontent.com/0bd39df200c40dd2d9cc3839d15f0c41e057f21ad7514c88b7333b2c554a8bb4/68747470733a2f2f706f7365722e707567782e6f72672f7374656666656e6272616e642f637572722d637572722f6c6963656e7365)](https://github.com/steffenbrand/curr-curr/blob/master/LICENSE.md)[![composer.lock available](https://camo.githubusercontent.com/c3f5f5195a824d0cb6728e9c5e3321aa0459cb2d4776895d39b9768bd461f5f1/68747470733a2f2f706f7365722e707567782e6f72672f7374656666656e6272616e642f637572722d637572722f636f6d706f7365726c6f636b)](https://github.com/steffenbrand/curr-curr/blob/master/composer.lock)

[![CurrCurr Logo](https://github.com/steffenbrand/curr-curr/raw/master/curr-curr.jpg?raw=true)](https://github.com/steffenbrand/curr-curr/blob/master/curr-curr.jpg?raw=true)

Delivers current exchange rates for EUR provided by the ECB under  as PHP objects.

- [CurrCurr on Packagist](https://packagist.org/packages/steffenbrand/curr-curr)
- [CurrCurr on GitHub](https://github.com/steffenbrand/curr-curr)

How to install
--------------

[](#how-to-install)

```
composer require steffenbrand/curr-curr

```

How to use
----------

[](#how-to-use)

### Request exchange rate for specific currency

[](#request-exchange-rate-for-specific-currency)

```
try {
    $cc = new CurrCurr();
    $exchangeRate = $cc->getExchangeRateByCurrency(Currency::USD);

    $exchangeRate->getDate();
    $exchangeRate->getCurrency();
    $exchangeRate->getRate();
} catch (ExchangeRatesRequestFailedException $e) {
    // webservice might not be present
} catch (ExchangeRatesMappingFailedException $e) {
    // webservice might not deliver what we expect
} catch (CurrencyNotSupportedException $e) {
    // requested currency might not be provided
}
```

### Request all available exchange rates

[](#request-all-available-exchange-rates)

```
try {
    $cc = new CurrCurr();
    $exchangeRates = $cc->getExchangeRates();

    $exchangeRates[Currency::USD]->getDate();
    $exchangeRates[Currency::USD]->getCurrency();
    $exchangeRates[Currency::USD]->getRate();

    foreach ($exchangeRates as $exchangeRate) {
        $exchangeRate->getDate();
        $exchangeRate->getCurrency();
        $exchangeRate->getRate();
    }
} catch (ExchangeRatesRequestFailedException $e) {
    // webservice might not be present
} catch (ExchangeRatesMappingFailedException $e) {
    // webservice might not deliver what we expect
}
```

### Using PSR-16 SimpleCache

[](#using-psr-16-simplecache)

CurrCurr does not provide its own SimpleCache implementation, however it does give you the possibility to inject any [PSR-16 compliant implementation](https://packagist.org/providers/psr/simple-cache-implementation) into the EcbClient. You just have to wrap it with a CacheConfig instance.

```
$cc = new CurrCurr(
    new EcbClient(
        EcbClient::DEFAULT_EXCHANGE_RATES_URL,
        new CacheConfig(
            new OpCache(sys_get_temp_dir() . '/cache')
            // Any PSR-16 compliant implementation
            // This example uses odan/cache
        )
    )
);
```

You can provide your own key and time to live.

```
new CacheConfig(
    new OpCache(sys_get_temp_dir() . '/cache')
    CacheConfig::CACHE_UNTIL_MIDNIGHT, // time to live in seconds
    CacheConfig::DEFAULT_CACHE_KEY // key used for caching
);
```

### Mocking webservice response for Unit Testing your own project

[](#mocking-webservice-response-for-unit-testing-your-own-project)

CurrCurr allows you to inject your own implementation of the EcbClientInterface. But you can also use the provided EcbClientMock, which allows you to simulate 3 different responses.

```
$cc1 = new CurrCurr(new EcbClientMock(EcbClientMock::VALID_RESPONSE));
$cc2 = new CurrCurr(new EcbClientMock(EcbClientMock::USD_MISSING_RESPONSE));
$cc3 = new CurrCurr(new EcbClientMock(EcbClientMock::DATE_MISSING_RESPONSE));
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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 ~571 days

Total

4

Last Release

1651d ago

Major Versions

3.1.1 → 4.0.12018-05-30

PHP version history (3 changes)3.1.0PHP &gt;=7.0

4.0.1PHP ^7.1 || ^7.2

4.1.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c0012c84bdbe5a801bef48e509ea28f5aa0359dcba13286ff6065a298f21c49?d=identicon)[steffenbrand](/maintainers/steffenbrand)

---

Top Contributors

[![steffenbrand](https://avatars.githubusercontent.com/u/5013806?v=4)](https://github.com/steffenbrand "steffenbrand (69 commits)")

---

Tags

currencycurrency-exchange-ratesexchange-ratephpmoneycurrencyexchange ratesEURUSDCNYtryECBeurodollarezbcadronRUBJPYBGNCZKDKKGBPHUFPLNSEKCHFNOKHRKAUDBRLHKDIDRILSINRKRWMXNMYRNZDSGDTHBZAR

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/steffenbrand-curr-curr/health.svg)

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[florianv/swap

Exchange rates library for PHP

1.3k6.4M16](/packages/florianv-swap)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[florianv/laravel-swap

Currency exchange rates library for Laravel and Lumen

3342.0M2](/packages/florianv-laravel-swap)[ujjwal/currency-converter

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

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

PHPackages © 2026

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