PHPackages                             openwse/laravel-swap - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. openwse/laravel-swap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

openwse/laravel-swap
====================

Currency exchange rates library for Laravel and Lumen

2.3.1(4y ago)06MITPHPPHP ^7.1.3 || ^8.0

Since Jun 10Pushed 4y agoCompare

[ Source](https://github.com/openwse/laravel-swap)[ Packagist](https://packagist.org/packages/openwse/laravel-swap)[ Docs](https://github.com/florianv/laravel-swap)[ RSS](/packages/openwse-laravel-swap/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (19)Used By (0)

[![](https://camo.githubusercontent.com/e9f2edc0c4c1fdecc071323f862b779f03a21b1b4d83746b97fbf4e01f607ac9/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f737761702e6173736574732f737761705f6c6f676f2e706e67)](https://camo.githubusercontent.com/e9f2edc0c4c1fdecc071323f862b779f03a21b1b4d83746b97fbf4e01f607ac9/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f737761702e6173736574732f737761705f6c6f676f2e706e67) Laravel Swap
======================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-laravel-swap)

[![Build status](https://camo.githubusercontent.com/17a0108a79f458e833008ee07f1cf44853c40b5691c0ba6e7580d45c0bce74b9/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f666c6f7269616e762f6c61726176656c2d737761702e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/florianv/laravel-swap)[![Total Downloads](https://camo.githubusercontent.com/5b1edec1be0de53be65e1a93b3a34da132fd5be839d3ff0ea2a553bc3734d4fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6f7269616e762f6c61726176656c2d737761702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/florianv/laravel-swap)[![Scrutinizer](https://camo.githubusercontent.com/e8f4ecce328d108cbfd59c3f6c8f0c751f8deb32c184d236558752bc187b04df/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666c6f7269616e762f6c61726176656c2d737761702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/florianv/laravel-swap)[![Version](https://camo.githubusercontent.com/559537999e949ac5db42ad9bc20b98db735a41af9523078c7552f30fa6b73d75/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c6f7269616e762f6c61726176656c2d737761702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/florianv/laravel-swap)

Swap allows you to retrieve currency exchange rates from various services such as **[Fixer](https://fixer.io)**, **[currencylayer](https://currencylayer.com)**, **[exchangeratesapi](https://exchangeratesapi.io)** or **[Abstract](https://www.abstractapi.com)** and optionally cache the results.

Sponsors
--------

[](#sponsors)

  [![](https://camo.githubusercontent.com/8ca444a24633a18b613b34304afdb3c6eb567477ab47fa409b2256b8b2b9db92/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f737761702e6173736574732f66697865725f69636f6e2e706e673f763d32)](https://camo.githubusercontent.com/8ca444a24633a18b613b34304afdb3c6eb567477ab47fa409b2256b8b2b9db92/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f737761702e6173736574732f66697865725f69636f6e2e706e673f763d32) [Fixer](https://fixer.io) is a simple and lightweight API for foreign exchange rates that supports up to 170 world currencies.   [![](https://camo.githubusercontent.com/077e83e24e837da81df47eb21cd4d2bfbc61879211243dc666314fc22108f918/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f737761702e6173736574732f63757272656e63796c617965725f69636f6e2e706e67)](https://camo.githubusercontent.com/077e83e24e837da81df47eb21cd4d2bfbc61879211243dc666314fc22108f918/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f737761702e6173736574732f63757272656e63796c617965725f69636f6e2e706e67) [currencylayer](https://currencylayer.com) provides reliable exchange rates and currency conversions for your business up to 168 world currencies.   [![](https://camo.githubusercontent.com/ed7ef6d123343df057690fe1abda6b27f2a12c160569772bee98e09bbd17c3f1/68747470733a2f2f65786368616e676572617465736170692e696f2f6173736574732f696d616765732f6170692d6c6f676f2e737667)](https://camo.githubusercontent.com/ed7ef6d123343df057690fe1abda6b27f2a12c160569772bee98e09bbd17c3f1/68747470733a2f2f65786368616e676572617465736170692e696f2f6173736574732f696d616765732f6170692d6c6f676f2e737667) [exchangeratesapi](https://exchangeratesapi.io) provides reliable exchange rates and currency conversions for your business with over 15 data sources.   [![](https://camo.githubusercontent.com/2368b322f25b7b03e11bc7f59f0256397a2cbcbd14fc0f923d91d14dfa24f902/68747470733a2f2f676c6f62616c2d75706c6f6164732e776562666c6f772e636f6d2f3565626264306135363661333939363633366535353935392f3565633262613237656465393833393137646266663232665f66617669636f6e2e706e67)](https://camo.githubusercontent.com/2368b322f25b7b03e11bc7f59f0256397a2cbcbd14fc0f923d91d14dfa24f902/68747470733a2f2f676c6f62616c2d75706c6f6164732e776562666c6f772e636f6d2f3565626264306135363661333939363633366535353935392f3565633262613237656465393833393137646266663232665f66617669636f6e2e706e67) [Abstract](https://www.abstractapi.com/) provides simple exchange rates for developers and a dozen of APIs covering thousands of use cases.  QuickStart
----------

[](#quickstart)

### Installation

[](#installation)

```
$ composer require php-http/curl-client nyholm/psr7 php-http/message florianv/laravel-swap
```

### Laravel 5.7 or lesser

[](#laravel-57-or-lesser)

If you use cache, add also PSR-6 adapter and PSR-16 bridge cache dependencies :

```
$ composer require cache/illuminate-adapter cache/simple-cache-bridge
```

These dependencies are not required with Laravel 5.8 or greater which [implements PSR-16](https://github.com/laravel/framework/pull/27217).

### Laravel 5.5+

[](#laravel-55)

If you don't use auto-discovery, add the `ServiceProvider` to the providers array in `config/app.php`:

```
// /config/app.php
'providers' => [
    Swap\Laravel\SwapServiceProvider::class
],
```

If you want to use the facade to log messages, add this to your facades in app.php:

```
'aliases' => [
    'Swap' => Swap\Laravel\Facades\Swap::class
]

```

Copy the package config to your local config with the publish command:

```
$ php artisan vendor:publish --provider="Swap\Laravel\SwapServiceProvider"
```

### Lumen

[](#lumen)

Configure the Service Provider and alias:

```
// /boostrap/app.php

// Register the facade
$app->withFacades(true, [
    Swap\Laravel\Facades\Swap::class => 'Swap'
]);

// Load the configuration
$app->configure('swap');

// Register the service provider
$app->register(Swap\Laravel\SwapServiceProvider::class);
```

Copy the [configuration](config/swap.php) to `/config/swap.php` if you wish to override it.

Usage
-----

[](#usage)

```
// Get the latest EUR/USD rate
$rate = Swap::latest('EUR/USD');

// 1.129
$rate->getValue();

// 2016-08-26
$rate->getDate()->format('Y-m-d');

// Get the EUR/USD rate yesterday
$rate = Swap::historical('EUR/USD', Carbon\Carbon::yesterday());
```

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

[](#documentation)

The complete documentation can be found [here](https://github.com/florianv/laravel-swap/blob/master/doc/readme.md).

Services
--------

[](#services)

Here is the list of the currently implemented services:

ServiceBase CurrencyQuote CurrencyHistorical[Fixer](https://fixer.io)EUR (free, no SSL), \* (paid)\*Yes[currencylayer](https://currencylayer.com)USD (free), \* (paid)\*Yes[exchangeratesapi](https://exchangeratesapi.io)USD (free), \* (paid)\*Yes[Abstract](https://www.abstractapi.com)\*\*Yes[coinlayer](https://coinlayer.com)\* Crypto (Limited standard currencies)\* Crypto (Limited standard currencies)Yes[European Central Bank](https://www.ecb.europa.eu/home/html/index.en.html)EUR\*Yes[National Bank of Romania](http://www.bnr.ro)RON, AED, AUD, BGN, BRL, CAD, CHF, CNY, CZK, DKK, EGP, EUR, GBP, HRK, HUF, INR, JPY, KRW, MDL, MXN, NOK, NZD, PLN, RSD, RUB, SEK, TRY, UAH, USD, XAU, XDR, ZARRON, AED, AUD, BGN, BRL, CAD, CHF, CNY, CZK, DKK, EGP, EUR, GBP, HRK, HUF, INR, JPY, KRW, MDL, MXN, NOK, NZD, PLN, RSD, RUB, SEK, TRY, UAH, USD, XAU, XDR, ZARYes[Central Bank of the Republic of Turkey](http://www.tcmb.gov.tr)\*TRYYes[Central Bank of the Czech Republic](https://www.cnb.cz)\*CZKYes[Central Bank of Russia](https://cbr.ru)\*RUBYes[Bulgarian National Bank](http://bnb.bg)\*BGNYes[WebserviceX](http://www.webservicex.net)\*\*No[1Forge](https://1forge.com)\* (free but limited or paid)\* (free but limited or paid)No[Cryptonator](https://www.cryptonator.com)\* Crypto (Limited standard currencies)\* Crypto (Limited standard currencies)No[CurrencyDataFeed](https://currencydatafeed.com)\* (free but limited or paid)\* (free but limited or paid)No[Open Exchange Rates](https://openexchangerates.org)USD (free), \* (paid)\*Yes[Xignite](https://www.xignite.com)\*\*Yes[Currency Converter API](https://www.currencyconverterapi.com)\*\*Yes (free but limited or paid)[xChangeApi.com](https://xchangeapi.com)\*\*Yes[fastFOREX.io](https://www.fastforex.io)USD (free), \* (paid)\*NoArray\*\*YesCredits
-------

[](#credits)

- [Florian Voutzinos](https://github.com/florianv)
- [All Contributors](https://github.com/florianv/laravel-swap/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](https://github.com/florianv/laravel-swap/blob/master/LICENSE) for more information.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 82.1% 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 ~144 days

Recently: every ~278 days

Total

18

Last Release

1583d ago

Major Versions

0.x-dev → 1.0.02016-10-09

1.x-dev → 2.0.02019-02-12

PHP version history (4 changes)v0.1.0PHP &gt;=5.5.9

1.0.0PHP ^5.5|^7.0

2.0.0PHP ^7.1.3

2.3.0PHP ^7.1.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/74194234?v=4)[openwse](/maintainers/openwse)[@openwse](https://github.com/openwse)

---

Top Contributors

[![florianv](https://avatars.githubusercontent.com/u/1586668?v=4)](https://github.com/florianv "florianv (69 commits)")[![kslimani](https://avatars.githubusercontent.com/u/1758996?v=4)](https://github.com/kslimani "kslimani (7 commits)")[![alies-dev](https://avatars.githubusercontent.com/u/5278175?v=4)](https://github.com/alies-dev "alies-dev (2 commits)")[![denlapaev](https://avatars.githubusercontent.com/u/3096564?v=4)](https://github.com/denlapaev "denlapaev (1 commits)")[![arjanwestdorp](https://avatars.githubusercontent.com/u/7716654?v=4)](https://github.com/arjanwestdorp "arjanwestdorp (1 commits)")[![mohammad6006](https://avatars.githubusercontent.com/u/553379?v=4)](https://github.com/mohammad6006 "mohammad6006 (1 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (1 commits)")[![openwse](https://avatars.githubusercontent.com/u/74194234?v=4)](https://github.com/openwse "openwse (1 commits)")[![simplenotezy](https://avatars.githubusercontent.com/u/3786627?v=4)](https://github.com/simplenotezy "simplenotezy (1 commits)")

---

Tags

laravelmoneycurrencylumenconversionRateexchange rates

### Embed Badge

![Health badge](/badges/openwse-laravel-swap/health.svg)

```
[![Health](https://phpackages.com/badges/openwse-laravel-swap/health.svg)](https://phpackages.com/packages/openwse-laravel-swap)
```

###  Alternatives

[florianv/swap

PHP currency conversion library for retrieving exchange rates from 30+ providers, with caching and fallback.

1.3k6.8M23](/packages/florianv-swap)[florianv/laravel-swap

Drop-in Laravel currency conversion: auto-discovered service provider, facade, and config. Multi-provider exchange rates.

3402.2M3](/packages/florianv-laravel-swap)[torann/currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.

4031.1M6](/packages/torann-currency)[danielme85/laravel-cconverter

Laravel 5 plug-in for currency conversion

42102.7k](/packages/danielme85-laravel-cconverter)

PHPackages © 2026

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