PHPackages                             redcode/currency-rate - 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. [API Development](/categories/api)
4. /
5. redcode/currency-rate

ActiveLibrary[API Development](/categories/api)

redcode/currency-rate
=====================

Useful library for fetching currency rates from cbr and ecb providers

0.2.4(10y ago)4507.7k↓31.8%3[2 issues](https://github.com/redco/redcode-currency-rate/issues)2MITPHPPHP &gt;=5.4.0

Since May 21Pushed 10y ago2 watchersCompare

[ Source](https://github.com/redco/redcode-currency-rate)[ Packagist](https://packagist.org/packages/redcode/currency-rate)[ Docs](https://github.com/maZahaca/redcode-currency-rate)[ RSS](/packages/redcode-currency-rate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (9)Used By (2)

Currency Rates converter library [![Latest Stable Version](https://camo.githubusercontent.com/1f7d78674dd119cc14050f89f10eb246d4af6fc3688fc9fa460d9adfd4ea2fa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726564636f64652f63757272656e63792d726174652e7376673f7374796c653d666c6174)](https://packagist.org/packages/redcode/currency-rate) [![Total Downloads](https://camo.githubusercontent.com/3772db65396fcf51b66b0b2d942c622c470cfb428846adc3d10e7b1e6b7bc753/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726564636f64652f63757272656e63792d726174652e7376673f7374796c653d666c6174)](https://packagist.org/packages/redcode/currency-rate)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#currency-rates-converter-library--)

[![Build Status](https://camo.githubusercontent.com/edbc4bf40e228cd3532c65be418839ab7aad1cf8de4e797fbb69349b8aee0356/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f726564636f2f726564636f64652d63757272656e63792d726174652e7376673f7374796c653d666c6174)](https://travis-ci.org/redco/redcode-currency-rate)[![Code Coverage](https://camo.githubusercontent.com/2746a60b04335835e97d813aa5ce014921ce33f0c03d4924c1c1295a726e85ec/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f726564636f2f726564636f64652d63757272656e63792d726174652e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/redco/redcode-currency-rate/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5382e30e5b3fed6e0d082b86218a4463e43b16155b85425d320229400b28107e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f726564636f2f726564636f64652d63757272656e63792d726174652e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/redco/redcode-currency-rate/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/c3341e65ccb63ab2d54d9507b81c5e949fd2f9743834e54e46236f5941881608/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f62373764313432662d343765622d346533302d383166622d6564353662666635653562662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/b77d142f-47eb-4e30-81fb-ed56bff5e5bf)[![Dependency Status](https://camo.githubusercontent.com/f444c5ac345f6bb0f3e69870ab1b0aa9079cae8e34af29e9919212bc5b1e1468/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3535303561656262346131303634373237373030303531642f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/5505aebb4a1064727700051d)

This library shows an efficient way to work with currencies and currency rates form [Central Bank of Russia](http://www.cbr.ru/eng/), [European Central Bank](https://www.ecb.europa.eu), and [Yahoo Finance](https://finance.yahoo.com/currency-converter/). It contains base classes and interfaces which hide logic about loading currency rates, one of the most useful implementation is [Symfony2 bundle](https://github.com/redco/redcode-currency-rate-bundle).

Installing
----------

[](#installing)

### Composer

[](#composer)

You can easily install it with [composer](https://getcomposer.org) by command:

```
composer require redcode/currency-rate

```

Documentation
-------------

[](#documentation)

First of all you need to implement services [ICurrencyRateManager](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Manager/CurrencyRateManager.php), [ICurrencyManager](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Manager/CurrencyManager.php). Then DTO or Entity objects [Currency](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Model/Currency.php) and [CurrencyRate](https://github.com/redco/redcode-currency-rate-bundle/blob/master/Model/CurrencyRate.php).

After that create and configure currencyConverter:

```
use RedCode\Currency\Rate;

// we have initialized $currencyRateManager and $currencyManager

$providerFactory = new Provider\ProviderFactory();
$providerFactory->addProvider(
  new Provider\EcbCurrencyRateProvider`(
    $currencyRateManager,
    $currencyManager
  )
);

$converter = new CurrencyConverter(
  $providerFactory,
  $currencyRateManager,
  $currencyManager
);

$convertedValue = $converter->convert('USD', 'GBP', 100);
```

Tests
-----

[](#tests)

To run [tests](https://github.com/redco/redcode-currency-rate/tree/master/tests) use command below:

```
./tests/runTests.sh
```

Contribute
----------

[](#contribute)

Pull requests are welcome. Please see our [CONTRIBUTING](https://github.com/redco/redcode-currency-rate/blob/master/CONTRIBUTING.md) guide.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~122 days

Recently: every ~56 days

Total

8

Last Release

3885d ago

PHP version history (2 changes)0.1.0-alphaPHP &gt;=5.4.4

0.2.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/141e58f9f8c19ad2f259d706caade38f44873f47260e09ae03c2cc1effa32bed?d=identicon)[maZahaca](/maintainers/maZahaca)

---

Top Contributors

[![maZahaca](https://avatars.githubusercontent.com/u/1290067?v=4)](https://github.com/maZahaca "maZahaca (40 commits)")[![remedge](https://avatars.githubusercontent.com/u/285520?v=4)](https://github.com/remedge "remedge (16 commits)")

---

Tags

currencyloaderconverterRatecbr.ruwww.ecb.europa.eu

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/redcode-currency-rate/health.svg)

```
[![Health](https://phpackages.com/badges/redcode-currency-rate/health.svg)](https://phpackages.com/packages/redcode-currency-rate)
```

###  Alternatives

[gabrielbull/ups-api

PHP UPS API

4642.4M10](/packages/gabrielbull-ups-api)[gavroche/ups-api

PHP UPS API

45613.2k](/packages/gavroche-ups-api)[stichoza/nbg-currency

National Bank of Georgia (NBG) currency service API wrapper

2925.2k1](/packages/stichoza-nbg-currency)[maciej-sz/nbp-php

API for accessing Polish National Bank (NBP - Narodowy Bank Polski) currency and commodities exchange rates

1343.3k1](/packages/maciej-sz-nbp-php)[coinpaymentsnet/coinpayments-php

A PHP wrapper for the CoinPayments.net v1 API.

55126.2k](/packages/coinpaymentsnet-coinpayments-php)[currency-cloud/client

A PHP library which implements the complete functionality of v2 of the The Currency Cloud API.

17327.2k](/packages/currency-cloud-client)

PHPackages © 2026

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