PHPackages                             mrzard/open-exchange-rates-bundle - 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. mrzard/open-exchange-rates-bundle

ActiveSymfony-bundle[API Development](/categories/api)

mrzard/open-exchange-rates-bundle
=================================

OpenExchangeRates API exposure for Symfony2

v3.0.1(8y ago)94.8k5MITPHPPHP &gt;=5.6.0

Since Mar 26Pushed 8y ago2 watchersCompare

[ Source](https://github.com/mrzard/OpenExchangeRatesBundle)[ Packagist](https://packagist.org/packages/mrzard/open-exchange-rates-bundle)[ RSS](/packages/mrzard-open-exchange-rates-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (4)Versions (15)Used By (0)

OpenExchangeRates for Symfony2
==============================

[](#openexchangerates-for-symfony2)

[![SensioLabsInsight](https://camo.githubusercontent.com/ab1725ac4820caafa4ac2c8d25b0cb3b1872b7488c7e42aa6a7fa43c580f71e0/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63653463643163642d663465352d343265642d383838312d3761376434333666346634312f6d696e692e706e67)](https://insight.sensiolabs.com/projects/ce4cd1cd-f4e5-42ed-8881-7a7d436f4f41)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c885f950191c21fa502610d4b67824b48bf6b52904eb329505e48bb6a690c6cf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d727a6172642f4f70656e45786368616e6765526174657342756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f733d34643762333637663462366535323066353239383336663936663666386666366665663763656565)](https://scrutinizer-ci.com/g/mrzard/OpenExchangeRatesBundle/)[![Build Status](https://camo.githubusercontent.com/9e4dc3eec0a80adfa399cac749d9fdac7447f2f3d4c6818f6d39603acfadad8e/68747470733a2f2f7472617669732d63692e6f72672f6d727a6172642f4f70656e45786368616e6765526174657342756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mrzard/OpenExchangeRatesBundle)

Version families
----------------

[](#version-families)

Branch 2.0.0 will give support to Symfony &gt;= 2.3

Branch 3.0.0 will give support to Symfony &gt;=3 (WIP)

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

[](#installation)

```
$ php composer.phar require mrzard/open-exchange-rates-bundle ~2.0.0
```

And register the bundle in your AppKernel.php file

```
return array(
   // ...
   new Mrzard\OpenExchangeRatesBundle\OpenExchangeRatesBundle(),
   // ...
);
```

Configuration
-------------

[](#configuration)

You will have to define your api id in the parameters.yml file of you environment.

Then, add this to your services.yml file

```
open_exchange_rates:
    api_id: %YOUR_API_ID_PARAM%
    api_configuration:
        https: true|false #defaults to false
        base_currency: XXX #defaults to USD
```

If you're using a free version, you won't need to change the `https` or `base_currency` as they only work fror Enterprise/Unlimited accounts

Usage
-----

[](#usage)

You can access the service by getting it from the container under open\_exchange\_rates\_service

Keep in mind that some options will only work properly with an Enterprise/Unlimited Plan

Free features
-------------

[](#free-features)

### Get latest exchange rates

[](#get-latest-exchange-rates)

```
/**
 * Get the latest exchange rates
 *
 * @param array  $symbols Currency codes to get the rates for. Default all
 * @param string $base    Base currency, default NULL (gets it from config)
 *
 * @return array
 */
public function getLatest($symbols = array, $base = null)
{
}
```

Only use the `$symbols` and `$base` parameters if you have an Enterprise or Unlimited plan.

Output:

```
array (size=5)
  'disclaimer' => string 'Exchange rates...'
  'license' => string 'Data sourced from...'
  'timestamp' => int 1395396061
  'base' => string 'USD' (length=3)
  'rates' =>
    array (size=166)
      'AED' => float 3.672721
      'AFN' => float 56.747225
      'ALL' => float 101.7573
      'AMD' => float 417.366998
      ...
    )
)

```

### Get available currencies

[](#get-available-currencies)

```
/**
 * Gets a list of all available currencies
 *
 * @return array with keys = ISO codes, content = Currency Name
 */
public function getCurrencies()
{
}
```

Output:

```
array (size=5)
  'AED' => 'United Arab Emirates Dirham'
  'AFN' => 'Afghan Afghani'
  'ALL' => 'Albanian Lek'
  'AMD' => 'Armenian Dram'
  'ANG' => 'Netherlands Antillean Guilder'
  ...
)

```

### Get historical data for a date

[](#get-historical-data-for-a-date)

```
/**
 * Get historical data
 *
 * @param \DateTime $date
 */
public function getHistorical(\DateTime $date)
{
}
```

Output:

```
array (size=5)
  'disclaimer' => string 'Exchange rates...'
  'license' => string 'Data sourced from...'
  'timestamp' => int 1388617200
  'base' => string 'USD' (length=3)
  'rates' =>
    array (size=166)
      'AED' => float 3.672524
      'AFN' => float 56.0846
      'ALL' => float 102.06575
      'AMD' => float 408.448002
      'ANG' => float 1.78902
      'AOA' => float 97.598401
      'ARS' => float 6.51658
      'AUD' => float 1.124795
      'AWG' => float 1.789775
      'AZN' => float 0.7841
      'BAM' => float 1.421715
      'BBD' => int 2
      ...
    )
)

```

Developer / Unlimited features
------------------------------

[](#developer--unlimited-features)

### Get the latest exchange rates, limiting the return array

[](#get-the-latest-exchange-rates-limiting-the-return-array)

```
$openExchangeRatesService->getLatest(['EUR', 'USD', 'COP']);
```

Output:

```
array (size=5)
  'disclaimer' => string 'Exchange rates ...'
  'license' => string 'Data sourced...'
  'timestamp' => int 1395396061
  'base' => string 'USD' (length=3)
  'rates' =>
    array (size=3)
      'EUR' => ...,
      'USD' => ...,
      'COP' => ...
    )
)

```

You can also change the base currency used to get the latest exchange rates with the second parameter

### Directly convert a quantity between currencies

[](#directly-convert-a-quantity-between-currencies)

```
$openExchangeRatesService->convert(10, 'USD', 'EUR');
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 81% 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 ~103 days

Recently: every ~47 days

Total

14

Last Release

3084d ago

Major Versions

v0.2.0 → v2.0.02016-07-06

v2.1.1 → v3.0.02016-12-16

v2.x-dev → v3.0.12017-12-01

PHP version history (3 changes)v0.1.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=5.5.0

v2.1.0PHP &gt;=5.6.0

### Community

Maintainers

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

---

Top Contributors

[![mrzard](https://avatars.githubusercontent.com/u/1557869?v=4)](https://github.com/mrzard "mrzard (17 commits)")[![mmoreram](https://avatars.githubusercontent.com/u/521409?v=4)](https://github.com/mmoreram "mmoreram (3 commits)")[![jfortunato](https://avatars.githubusercontent.com/u/1606681?v=4)](https://github.com/jfortunato "jfortunato (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mrzard-open-exchange-rates-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mrzard-open-exchange-rates-bundle/health.svg)](https://phpackages.com/packages/mrzard-open-exchange-rates-bundle)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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