PHPackages                             rakoza/fixerio - 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. rakoza/fixerio

ActiveLibrary[API Development](/categories/api)

rakoza/fixerio
==============

Wrapper for Fixer.io

2.1.0(4y ago)019MITPHPPHP &gt;=5.4.0

Since Nov 18Pushed 4y agoCompare

[ Source](https://github.com/rakoza/Fixerio)[ Packagist](https://packagist.org/packages/rakoza/fixerio)[ RSS](/packages/rakoza-fixerio/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (7)Used By (0)

Thin wrapper for Fixer.io
=========================

[](#thin-wrapper-for-fixerio)

A thin wrapper for [Fixer.io](http://www.fixer.io), a service for foreign exchange rates and currency conversion. It provides a few methods to easily construct the url, makes the api call and gives back the response.

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

[](#installation)

- Add the package to your composer.json file and run `composer update`:

```
{
    "require": {
        "rakoza/fixerio": "~1.0"
    }
}
```

Laravel users can use the Facade for even easier access.

- Add `Rakoza\Fixerio\ExchangeServiceProvider::class` to your `config/app.php` file, inside the `providers` array.
- Add a new alias: `'Exchange' => Rakoza\Fixerio\Facades\Exchange::class` to your `config/app.php` file, inside the `aliases` array.

Usage
-----

[](#usage)

Let's get the rates of EUR and GBP with USD as the base currency:

```
use Rakoza\Fixerio\Exchange;
use Rakoza\Fixerio\Currency;

$exchange = new Exchange();
$exchange->key("YOUR_ACCESS_KEY");
$exchange->base(Currency::USD);
$exchange->symbols(Currency::EUR, Currency::GBP);

$rates = $exchange->get();
```

By default, the base currency is `EUR`, so if that's your base, there's no need to set it. The symbols can be omitted too, as Fixer will return all the supported currencies.

A simplified example without the base and currency:

```
$rates = (new Exchange())->key("YOUR_ACCESS_KEY")->get();
```

The `historical` option will return currency rates for every day since the date you've specified. The base currency and symbols can be omitted here to, but let's see a full example:

```
$exchange = new Exchange();
$exchange->key("YOUR_ACCESS_KEY");
$exchange->historical('2012-12-12');
$exchange->base(Currency::AUD);
$exchange->symbols(Currency::USD, Currency::EUR, Currency::GBP);

$rates = $exchange->get();
```

Finally, you may have noticed the use of the `Currency` class with currencies as constants. It's just a convenience to prevent errors from typos, but they're completely optional.

This:

```
$exchange->base(Currency::AUD);
$exchange->symbols(Currency::USD, Currency::EUR, Currency::GBP);
```

is equivalent to:

```
$exchange->base('AUD');
$exchange->symbols('USD', 'EUR', 'GBP');
```

Use whatever method fills your needs.

Response
--------

[](#response)

The response is a simple array with currencies as keys and ratios as values. For a request like the following:

```
$rates = (new Exchange())->key("YOUR_ACCESS_KEY")->symbols(Currency::USD, Currency::GBP)->get();
```

the response will be an array:

```
array('GBP' => 0.7009, 'USD' => 1.0666)
```

which you can access with the keys as strings or using the currency constants:

```
print $rates['EUR'];
print $rates[Currency::GBP];
```

There is an option to handle the response as an object:

```
$rates = (new Exchange())->key("YOUR_ACCESS_KEY")->symbols(Currency::USD, Currency::GBP)->getAsObject();

print $rates->USD;
print $rates->GBP;
```

The last option is to return the response as a `Result` class. This allows access to the full set of properties returned from the feed.

```
$result = (new Exchange())->key("YOUR_ACCESS_KEY")->symbols(Currency::USD, Currency::GBP)->getResult();

$date = $result->getDate(); // The date the data is from
$rates = $result->getRates(); // Array of rates as above
$usd = $result->getRate(Currency::USD); // Will return null if there was no value
```

Error Handling
--------------

[](#error-handling)

To handle errors, the package provides 2 exceptions. `ConnectionException` when http requests go wrong and `ResponseException` when the returned response from the api is not as expected. An example with exception handling:

```
use Rakoza\Fixerio\Exchange;
use Rakoza\Fixerio\Exceptions\ConnectionException;
use Rakoza\Fixerio\Exceptions\ResponseException;

try {
    $exchange = new Exchange();
    $exchange->key("YOUR_ACCESS_KEY");
    $rates = $exchange->get();
}
catch (ConnectionException $e) {
    // handle
}
catch (ResponseException $e) {
    // handle
}
```

Laravel Usage
-------------

[](#laravel-usage)

Nothing changes for Laravel apart from the Facade. It's just a convenience for a tad shorter way of using the package:

```
use Exchange;
use Rakoza\Fixerio\Currency;

$rates = Exchange::base(Currency::USD)->get();
```

To use this Facade, you should set your access key in your `config/services.php` file:

```
'fixer'=>[
    'key'=>env("FIXER_ACCESS_KEY"),
]
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 70% 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 ~414 days

Recently: every ~517 days

Total

6

Last Release

1753d ago

Major Versions

1.2.0 → 2.0.02018-04-04

### Community

Maintainers

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

---

Top Contributors

[![fadion](https://avatars.githubusercontent.com/u/374519?v=4)](https://github.com/fadion "fadion (21 commits)")[![remyvhw](https://avatars.githubusercontent.com/u/558281?v=4)](https://github.com/remyvhw "remyvhw (5 commits)")[![djmarland](https://avatars.githubusercontent.com/u/105991?v=4)](https://github.com/djmarland "djmarland (2 commits)")[![rakoza](https://avatars.githubusercontent.com/u/6500610?v=4)](https://github.com/rakoza "rakoza (1 commits)")[![wstaples](https://avatars.githubusercontent.com/u/3649913?v=4)](https://github.com/wstaples "wstaples (1 commits)")

---

Tags

laravelfixerexchangefixer.io

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rakoza-fixerio/health.svg)

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

###  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)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[flat3/lodata

OData v4.01 Producer for Laravel

96320.9k](/packages/flat3-lodata)[fadion/fixerio

Wrapper for Fixer.io

49337.7k](/packages/fadion-fixerio)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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