Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

💱 Currency exchange rates library

License

NotificationsYou must be signed in to change notification settings

florianv/swap

Repository files navigation

Swap

Build statusTotal DownloadsVersion

Swap allows you to retrieve currency exchange rates from various services such asFixer,Currency Data orExchange Rates Data and optionally cache the results.It is integrated to other libraries likemoneyphp/money and providesaSymfony Bundle and aLaravel Package.

Sponsors

Fixer is a simple and lightweight API for foreign exchange rates that supports up to 170 world currencies.
currencylayer provides reliable exchange rates and currency conversions for your business up to 168 world currencies.
exchangerates provides reliable exchange rates and currency conversions for your business with over 15 data sources.

QuickStart

$ composer require php-http/curl-client nyholm/psr7 php-http/message florianv/swap
useSwap\Builder;// Build Swap$swap = (newBuilder())// Use the Fixer service as first level provider    ->add('apilayer_fixer', ['api_key' =>'Get your key here: https://fixer.io/'])// Use the currencylayer service as first fallback    ->add('apilayer_currency_data', ['api_key' =>'Get your key here: https://currencylayer.com'])// Use the exchangerates service as second fallback    ->add('apilayer_exchange_rates_data', ['api_key' =>'Get your key here: https://exchangeratesapi.io/'])->build();// 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 15 days ago$rate =$swap->historical('EUR/USD', (new \DateTime())->modify('-15 days'));

We recommend to use theservices that support our project, providing a free plan up to 100 requests per month.

Documentation

The documentation for the current branch can be foundhere.

Services

Here is the list of the currently implemented services:

ServiceBase CurrencyQuote CurrencyHistorical
FixerEUR (free, no SSL), * (paid)*Yes
Currency DataUSD (free), * (paid)*Yes
Exchange Rates DataUSD (free), * (paid)*Yes
Abstract**Yes
coinlayer* Crypto (Limited standard currencies)* Crypto (Limited standard currencies)Yes
FixerEUR (free, no SSL), * (paid)*Yes
Currency DataUSD (free), * (paid)*Yes
exchangeratesapiUSD (free), * (paid)*Yes
European Central BankEUR*Yes
National Bank of Georgia*GELYes
National Bank of the Republic of Belarus*BYN (from 01-07-2016),
BYR (01-01-2000 - 30-06-2016),
BYB (25-05-1992 - 31-12-1999)
Yes
National Bank of RomaniaRON, 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
National Bank of Ukranie*UAHYes
Central Bank of the Republic of Turkey*TRYYes
Central Bank of the Republic of Uzbekistan*UZSYes
Central Bank of the Czech Republic*CZKYes
Central Bank of Russia*RUBYes
Bulgarian National Bank*BGNYes
WebserviceX**No
1Forge* (free but limited or paid)* (free but limited or paid)No
Cryptonator* Crypto (Limited standard currencies)* Crypto (Limited standard currencies)No
CurrencyDataFeed* (free but limited or paid)* (free but limited or paid)No
Open Exchange RatesUSD (free), * (paid)*Yes
Xignite**Yes
Currency Converter API**Yes (free but limited or paid)
xChangeApi.com**Yes
fastFOREX.ioUSD (free), * (paid)*No
exchangerate.host**Yes
Array**Yes

Additionally, you can add your own services as long as they implement theExchangeRateService interface.

Integrations

Credits

License

The MIT License (MIT). Please seeLICENSE for more information.


[8]ページ先頭

©2009-2025 Movatter.jp