PHPackages                             rubin/openexchangerates - 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. rubin/openexchangerates

ActiveLibrary[API Development](/categories/api)

rubin/openexchangerates
=======================

OpenExchangeRates API connector

1.1.0(5mo ago)061PHPPHP &gt;=8.1.0CI passing

Since Oct 5Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/xRubin/OpenExchangeRates)[ Packagist](https://packagist.org/packages/rubin/openexchangerates)[ RSS](/packages/rubin-openexchangerates/feed)WikiDiscussions master Synced 1mo ago

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

OpenExchangeRates REST API
==========================

[](#openexchangerates-rest-api)

[![Build Status](https://github.com/xRubin/OpenExchangeRates/workflows/CI/badge.svg)](https://github.com/xRubin/OpenExchangeRates/actions)[![Latest Stable Version](https://camo.githubusercontent.com/e9ad72fb6d76c997bad3130c1a1481e9d87dd3fe910a13ce77cd012558b00f7c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f78527562696e2f4f70656e45786368616e67655261746573)](https://packagist.org/packages/rubin/openexchangerates)[![Coverage Status](https://camo.githubusercontent.com/addd923b65f4ef542b21848c8d198cd547a628935ef5b036975e64d3585bc8ef/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f78527562696e2f4f70656e45786368616e676552617465732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/xRubin/OpenExchangeRates?branch=master)[![PHP Version Require](https://camo.githubusercontent.com/93332750d227034e4d87aa7bee9174783967eac4dda8e11269820313af5097a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f727562696e2f4f70656e45786368616e676552617465732f7068703f636f6c6f723d373737424233)](https://camo.githubusercontent.com/93332750d227034e4d87aa7bee9174783967eac4dda8e11269820313af5097a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f727562696e2f4f70656e45786368616e676552617465732f7068703f636f6c6f723d373737424233)[![GitHub License](https://camo.githubusercontent.com/1a30fc2a41787da02f6e5026a92c23d7274035be432acb1c1760821c11803980/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f78527562696e2f4f70656e45786368616e67655261746573)](https://camo.githubusercontent.com/1a30fc2a41787da02f6e5026a92c23d7274035be432acb1c1760821c11803980/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f78527562696e2f4f70656e45786368616e67655261746573)

PHP implementation for the [OpenExchangeRates.org](https://openexchangerates.org/) REST API. This library is based on the [REST API docs](https://docs.openexchangerates.org/reference/api-introduction).

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

[](#installation)

With composer:

```
composer require rubin/openexchangerates
```

Usage
-----

[](#usage)

Create API connector:

```
$api = new OpenExchangeRates\OpenExchangeRatesApi('{APP_ID}');
```

Extra parameters
----------------

[](#extra-parameters)

### Set Base Currency ('base')

[](#set-base-currency-base)

The default base currency of the API is US Dollars (USD), but you can request exchange rates relative to a different base currency, where available, by setting the base parameter in your request.

```
$api->setBase('EUR');
```

### Get Specific Currencies ('symbols')

[](#get-specific-currencies-symbols)

By default, the API returns rates for all currencies, but if you need to minimise transfer size, you can request a limited subset of exchange rates, where available, by setting the symbols parameter in your request.

```
$api->setSymbols(['AMD', 'EUR']);
```

### Alternative Rates ('show\_alternative')

[](#alternative-rates-show_alternative)

You may now request latest and historical rates for unofficial, black market and alternative digital currencies by adding a simple API parameter onto your request.

```
$api->setShowAlternative(true);
```

API endpoints
-------------

[](#api-endpoints)

### /latest

[](#latest)

Get the latest exchange rates available from the Open Exchange Rates API.

The most simple route in our API, latest.json provides a standard response object containing all the conversion rates for all of the currently available symbols/currencies, labeled by their international-standard 3-letter ISO currency codes.

The latest rates will always be the most up-to-date data available on your plan.

```
echo "Symbol\tRate\n";
foreach ($api->getLatest()->rates as $symbol => $rate) {
    printf("%s\t%s\n", $symbol, $rate);
}
```

### /historical

[](#historical)

Get historical exchange rates for any date available from the Open Exchange Rates API, currently going back to 1st January 1999.

The historical rates returned are the last values published for a given UTC day (up to and including 23:59:59 UTC), except for the current UTC date.

```
echo "Symbol\tRate\n";
foreach ($api->getHistorical(new \DateTimeImmutable('2012-07-10'))->rates as $symbol => $rate) {
    printf("%s\t%s\n", $symbol, $rate);
}
```

### /currencies

[](#currencies)

Get a JSON list of all currency symbols available from the Open Exchange Rates API, along with their full names, for use in your integration.

This list will always mirror the currencies available in the latest rates (given as their 3-letter codes).

```
echo "Symbol\tName\n";
foreach ($api->getCurrencies() as $symbol => $name) {
    printf("%s\t%s\n", $symbol, $name);
}
```

### /usage

[](#usage-1)

Get basic plan information and usage statistics for an Open Exchange Rates App ID

```
var_dump($api->getUsage());
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance70

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

173d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.2.0

1.1.0PHP &gt;=8.1.0

### Community

Maintainers

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

---

Top Contributors

[![xRubin](https://avatars.githubusercontent.com/u/9638619?v=4)](https://github.com/xRubin "xRubin (8 commits)")

---

Tags

apiopenexchangerates

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rubin-openexchangerates/health.svg)

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

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