PHPackages                             houseofapis/currencyapi - 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. houseofapis/currencyapi

ActiveLibrary[API Development](/categories/api)

houseofapis/currencyapi
=======================

Composer package for the CurrencyApi.net JSON &amp; XML live currency feed

v3.1.0(2mo ago)2981MITPHPPHP ^8.1CI failing

Since Mar 23Pushed 2mo agoCompare

[ Source](https://github.com/houseofapis/currencyapi-php)[ Packagist](https://packagist.org/packages/houseofapis/currencyapi)[ Docs](https://currencyapi.net)[ RSS](/packages/houseofapis-currencyapi/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (3)Versions (12)Used By (0)

CurrencyApi PHP wrapper
=======================

[](#currencyapi-php-wrapper)

[![Latest Stable Version](https://camo.githubusercontent.com/dba9c4e2d00cd0da4eea2b100af2b370ddc74813b388149d113f7992d76a62dd/68747470733a2f2f706f7365722e707567782e6f72672f686f7573656f66617069732f63757272656e63796170692f762f737461626c65)](https://packagist.org/packages/houseofapis/currencyapi) [![License](https://camo.githubusercontent.com/35a65fa2ff851d7e11966a7b213cec74825bcf8138ee14e1f63a6133d143e8d2/68747470733a2f2f706f7365722e707567782e6f72672f686f7573656f66617069732f63757272656e63796170692f6c6963656e7365)](https://packagist.org/packages/houseofapis/currencyapi) [![Build Status](https://camo.githubusercontent.com/7bb5e7a6300f60c863fb348c450cd1189945dfe7d69de49ff51f8265db87c74d/68747470733a2f2f7472617669732d63692e6f72672f686f7573656f66617069732f63757272656e63796170692d7068702e7376673f6272616e63683d6d61696e)](https://travis-ci.org/houseofapis/currencyapi-php) [![Coverage Status](https://camo.githubusercontent.com/63e556120b8d99a6c71acda520a289f64d06ff8b4cf30c7eafb2b6c4b58d41bd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f686f7573656f66617069732f63757272656e63796170692d7068702f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/houseofapis/currencyapi-php?branch=main)

[CurrencyApi.net](https://currencyapi.net "CurrencyApi") provides live currency rates via a REST API. A live currency feed for over 166 currencies, including physical (USD, GBP, EUR + more) and cryptos (Bitcoin, Litecoin, Ethereum + more). A JSON and XML currency api updated every 60 seconds.

Features:

- Live exchange rates (updated every 60 seconds).
- 166+ world currencies.
- Popular cryptocurrencies included; Bitcoin, Litecoin etc.
- Convert currencies on the fly with the convert endpoint.
- Historical currency rates back to year 2000.
- OHLC (candlestick) data for technical analysis.
- Easy to follow [documentation](https://currencyapi.net/documentation "currency-api-documentation")

Signup for a free or paid account [here](https://currencyapi.net/pricing "currency-api-pricing").

> **Note:** API v1 is deprecated and will be retired on **31st July 2026**, at which point all v1 traffic will be redirected to v2. This SDK (v3.0.0+) targets API v2. If you are on an older version of this SDK, please upgrade.

This package is a:
------------------

[](#this-package-is-a)

PHP wrapper for [CurrencyApi.net](https://currencyapi.net "CurrencyApi") endpoints.

Developer Guide
---------------

[](#developer-guide)

For an easy to following developer guide, check out our [PHP Developer Guide](https://currencyapi.net/sdk/php).

Alternatively keep reading below.

#### Prerequisites

[](#prerequisites)

- Minimum PHP 8.1+
- Working on PHP 8.5
- Free or Paid account with CurrencyApi.net
- Composer or clone this repo

#### Test Coverage

[](#test-coverage)

- 100% coverage

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

[](#installation)

#### Using composer:

[](#using-composer)

```
composer require houseofapis/currencyapi
```

then include the package with:

```
use HouseOfApis\CurrencyApi\CurrencyApi;
```

#### Without composer:

[](#without-composer)

```
require_once('/path/to/currencyapi/src/CurrencyApi.php');
$currencyApi = new \CurrencyApi\CurrencyApi('API_KEY');
```

Usage
-----

[](#usage)

### Live rates:

[](#live-rates)

Returns the latest exchange rates for all supported currencies.

```
$result = $currencyApi->rates();
```

Example with all available methods:

```
$result = $currencyApi
    ->setBase('USD')
    ->setOutput('JSON')
    ->rates();
```

**Available methods for rates endpoint**

MethodsDescription`setBase()`The base currency you wish you receive the currency conversions for. This will output all currency conversions for that currency. **Default: USD**.`setOutput()`Response output in either JSON or XML. **Default: JSON**.
### List of available currencies:

[](#list-of-available-currencies)

Returns a list of all currencies supported by the API.

```
$result = $currencyApi->currencies();
```

Example with all available methods:

```
$result = $currencyApi
    ->setOutput('XML')
    ->currencies();
```

**Available methods for currencies endpoint**

MethodsDescription`setOutput()`Response output in either JSON or XML. **Default: JSON**.
### Convert:

[](#convert)

Converts an amount from one currency to another using the latest rates.

```
$result = $currencyApi
    ->setAmount(100)
    ->setFrom('BTC')
    ->setTo('GBP')
    ->convert();
```

**Available methods for convert endpoint**

MethodsDescription`setAmount()`The value of the currency you want to convert from. This should be a number and can contain a decimal place. **Required**.`setFrom()`The currency you want to convert. This will be a three letter ISO 4217 currency code from one of the currencies we have rates for. **Required**.`setTo()`The currency you want to convert the amount 'to'. Again this will be a three letter currency code from the ones we offer. **Required**.`setOutput()`Response output in either JSON or XML. **Default: JSON**.
### Historical:

[](#historical)

Returns exchange rates for all currencies on a specific date.

```
$result = $currencyApi->setDate('2019-01-01')->historical();
```

Example with all available methods:

```
$result = $currencyApi
    ->setDate('2019-01-01')
    ->setBase('GBP')
    ->setOutput('JSON')
    ->historical();
```

**Available methods for historical endpoint**

MethodsDescription`setDate()`The historical date you wish to receive the currency conversions for. This should be formatted as YYYY-MM-DD. **Required**.`setBase()`The base currency you wish you receive the currency conversions for. This will output all currency conversions for that currency. **Default: USD**.`setOutput()`Response output in either JSON or XML. **Default: JSON**.
### Timeframe:

[](#timeframe)

Returns exchange rates for all currencies across a date range, with one entry per day.

```
$result = $currencyApi->setStartDate('2019-01-01')->setEndDate('2019-01-05')->timeframe();
```

Example with all available methods:

```
$result = $currencyApi
    ->setStartDate('2019-01-01')
    ->setEndDate('2019-01-05')
    ->setBase('GBP')
    ->setOutput('XML')
    ->timeframe();
```

**Available methods for timeframe endpoint**

MethodsDescription`setStartDate()`The historical date you wish to receive the currency conversions from. This should be formatted as YYYY-MM-DD. **Required**.`setEndDate()`The historical date you wish to receive the currency conversions until. This should be formatted as YYYY-MM-DD. **Required**.`setBase()`The base currency you wish you receive the currency conversions for. This will output all currency conversions for that currency. **Default: USD**.`setOutput()`Response output in either JSON or XML. **Default: JSON**.
### OHLC (Open, High, Low, Close):

[](#ohlc-open-high-low-close)

Returns candlestick data for a currency pair on a given date, useful for charting and technical analysis.

```
$result = $currencyApi
    ->setQuote('EUR')
    ->setDate('2023-12-25')
    ->ohlc();
```

Example with all available methods:

```
$result = $currencyApi
    ->setQuote('EUR')
    ->setDate('2023-12-25')
    ->setBase('GBP')
    ->setInterval('1h')
    ->ohlc();
```

**Available methods for OHLC endpoint**

MethodsDescription`setQuote()`The quote currency to retrieve OHLC data for. Three letter ISO 4217 currency code. **Required**.`setDate()`The date to retrieve OHLC data for. This should be formatted as YYYY-MM-DD. **Required**.`setBase()`The base currency for the rates. **Default: USD**.`setInterval()`The interval for the OHLC candles. One of: `5m`, `15m`, `30m`, `1h`, `4h`, `12h`, `1d`. **Default: 1d**.**Example response:**

```
{
    "valid": true,
    "base": "USD",
    "quote": "EUR",
    "date": "2023-12-25",
    "interval": "1d",
    "ohlc": [
        {
            "start": "2023-12-25T00:00:00Z",
            "open": 0.9123,
            "high": 0.9187,
            "low": 0.9098,
            "close": 0.9154
        }
    ]
}
```

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance83

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

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

Recently: every ~540 days

Total

6

Last Release

85d ago

Major Versions

v1.1 → v2.0.02026-02-13

v2.0.0 → v3.0.02026-02-21

PHP version history (3 changes)v1.0.0PHP &gt;=7.1.0

v1.1PHP &gt;=7.1.0|^8

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fe7508b09c42fb99ea38d757a3c1f4f2def03a5aca7e37cdecc997233f901e7?d=identicon)[houseofapis](/maintainers/houseofapis)

---

Top Contributors

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

---

Tags

apicurrencycryptofeedlive-ratesjson currency

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/houseofapis-currencyapi/health.svg)

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

###  Alternatives

[coinpaymentsnet/coinpayments-php

A PHP wrapper for the CoinPayments.net v1 API.

55126.2k](/packages/coinpaymentsnet-coinpayments-php)

PHPackages © 2026

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