{"id":13623383,"url":"https://github.com/florianv/swap","last_synced_at":"2025-05-14T06:14:38.225Z","repository":{"id":16851826,"uuid":"19611718","full_name":"florianv/swap","owner":"florianv","description":":currency_exchange: Currency exchange rates library","archived":false,"fork":false,"pushed_at":"2025-03-06T10:28:56.000Z","size":935,"stargazers_count":1326,"open_issues_count":0,"forks_count":139,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-11T00:52:24.603Z","etag":null,"topics":["currency","currency-converter","currency-exchange","currency-exchange-rates","currency-rates","exchange-rates","money","php"],"latest_commit_sha":null,"homepage":"https://florianv.github.io/swap/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/florianv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-09T13:20:05.000Z","updated_at":"2025-04-10T03:52:58.000Z","dependencies_parsed_at":"2023-01-13T19:03:23.573Z","dependency_job_id":"9245c800-e5cd-4090-a63d-8d14352d6db0","html_url":"https://github.com/florianv/swap","commit_stats":{"total_commits":212,"total_committers":24,"mean_commits":8.833333333333334,"dds":"0.26415094339622647","last_synced_commit":"cfd2e7505740b0c9c7c05aefbeed368c2ba8cedf"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianv%2Fswap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianv%2Fswap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianv%2Fswap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianv%2Fswap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florianv","download_url":"https://codeload.github.com/florianv/swap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322609,"owners_count":21084336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["currency","currency-converter","currency-exchange","currency-exchange-rates","currency-rates","exchange-rates","money","php"],"created_at":"2024-08-01T21:01:31.134Z","updated_at":"2025-04-11T00:52:30.325Z","avatar_url":"https://github.com/florianv.png","language":"PHP","funding_links":[],"categories":["电子商务","Table of Contents","目录","PHP","电子商务 E-commerce","E-commerce","电子商务( E-commerce )","Central Banking and Monetary Policy"],"sub_categories":["E-commerce","电子商务 E-commerce","Platforms"],"readme":"# \u003cimg src=\"https://s3.amazonaws.com/swap.assets/swap_logo.png\" height=\"30px\" width=\"30px\"/\u003e Swap\n\n[![Build status](http://img.shields.io/travis/florianv/swap.svg?style=flat-square)](https://travis-ci.org/florianv/swap)\n[![Total Downloads](https://img.shields.io/packagist/dt/florianv/swap.svg?style=flat-square)](https://packagist.org/packages/florianv/swap)\n[![Version](http://img.shields.io/packagist/v/florianv/swap.svg?style=flat-square)](https://packagist.org/packages/florianv/swap)\n\nSwap allows you to retrieve currency exchange rates from various services such as **[Fixer](https://fixer.io/)**, **[Currency Data](https://currencylayer.com)** or **[Exchange Rates Data](https://exchangeratesapi.io/)** and optionally cache the results. \nIt is integrated to other libraries like [moneyphp/money](https://github.com/moneyphp/money) and provides\na [Symfony Bundle](https://github.com/florianv/FlorianvSwapBundle) and a [Laravel Package](https://github.com/florianv/laravel-swap).\n\n## Sponsors\n\n\u003ctable\u003e\n   \u003ctr\u003e\n      \u003ctd\u003e\u003cimg src=\"https://assets.apilayer.com/apis/fixer.png\" width=\"50px\"/\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://fixer.io/\"\u003eFixer\u003c/a\u003e is a simple and lightweight API for foreign exchange rates that supports up to 170 world currencies.\u003c/td\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n     \u003ctd\u003e\u003cimg src=\"https://assets.apilayer.com/apis/currency_data.png\" width=\"50px\"/\u003e\u003c/td\u003e\n     \u003ctd\u003e\u003ca href=\"https://currencylayer.com\"\u003ecurrencylayer\u003c/a\u003e provides reliable exchange rates and currency conversions for your business up to 168 world currencies.\u003c/td\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n     \u003ctd\u003e\u003cimg src=\"https://assets.apilayer.com/apis/exchangerates_data.png\" width=\"50px\"/\u003e\u003c/td\u003e\n     \u003ctd\u003e\u003ca href=\"https://exchangeratesapi.io/\"\u003eexchangerates\u003c/a\u003e provides reliable exchange rates and currency conversions for your business with over 15 data sources.\u003c/td\u003e\n   \u003c/tr\u003e\n\u003c/table\u003e\n\n## QuickStart\n\n```bash\n$ composer require php-http/curl-client nyholm/psr7 php-http/message florianv/swap\n```\n\n```php\nuse Swap\\Builder;\n\n// Build Swap\n$swap = (new Builder())\n\n    // Use the Fixer service as first level provider\n    -\u003eadd('apilayer_fixer', ['api_key' =\u003e 'Get your key here: https://fixer.io/'])\n     \n    // Use the currencylayer service as first fallback\n    -\u003eadd('apilayer_currency_data', ['api_key' =\u003e 'Get your key here: https://currencylayer.com'])\n    \n    // Use the exchangerates service as second fallback\n    -\u003eadd('apilayer_exchange_rates_data', ['api_key' =\u003e 'Get your key here: https://exchangeratesapi.io/'])\n-\u003ebuild();\n    \n// Get the latest EUR/USD rate\n$rate = $swap-\u003elatest('EUR/USD');\n\n// 1.129\n$rate-\u003egetValue();\n\n// 2016-08-26\n$rate-\u003egetDate()-\u003eformat('Y-m-d');\n\n// Get the EUR/USD rate 15 days ago\n$rate = $swap-\u003ehistorical('EUR/USD', (new \\DateTime())-\u003emodify('-15 days'));\n```\n\n\u003e We recommend to use the [services that support our project](#sponsors), providing a free plan up to 100 requests per month.\n\n## Documentation\n\nThe documentation for the current branch can be found [here](https://github.com/florianv/swap/blob/master/doc/readme.md).\n\n## Services\n\nHere is the list of the currently implemented services:\n\n| Service | Base Currency | Quote Currency | Historical |\n|---------------------------------------------------------------------------|----------------------|----------------|----------------|\n| [Fixer](https://fixer.io/) | EUR (free, no SSL), * (paid) | * | Yes |\n| [Currency Data](https://currencylayer.com) | USD (free), * (paid) | * | Yes |\n| [Exchange Rates Data](https://exchangeratesapi.io/) | USD (free), * (paid) | * | Yes |\n| [Abstract](https://www.abstractapi.com) | * | * | Yes |\n| [coinlayer](https://coinlayer.com) | * Crypto (Limited standard currencies) | * Crypto (Limited standard currencies) | Yes |\n| [Fixer](https://fixer.io) | EUR (free, no SSL), * (paid) | * | Yes |\n| [Currency Data](https://currencylayer.com) | USD (free), * (paid) | * | Yes |\n| [exchangeratesapi](https://exchangeratesapi.io) | USD (free), * (paid) | * | Yes |\n| [European Central Bank](https://www.ecb.europa.eu/home/html/index.en.html) | EUR | * | Yes |\n| [National Bank of Georgia](https://nbg.gov.ge) | * | GEL | Yes |\n| [National Bank of the Republic of Belarus](https://www.nbrb.by) | * | BYN (from 01-07-2016),\u003cbr\u003eBYR (01-01-2000 - 30-06-2016),\u003cbr\u003eBYB (25-05-1992 - 31-12-1999) | Yes |\n| [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, ZAR | 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, ZAR | Yes |\n| [National Bank of Ukranie](https://bank.gov.ua) | * | UAH | Yes |\n| [Central Bank of the Republic of Turkey](http://www.tcmb.gov.tr) | * | TRY | Yes |\n| [Central Bank of the Republic of Uzbekistan](https://cbu.uz) | * | UZS | Yes |\n| [Central Bank of the Czech Republic](https://www.cnb.cz) | * | CZK | Yes |\n| [Central Bank of Russia](https://cbr.ru) | * | RUB | Yes |\n| [Bulgarian National Bank](http://bnb.bg) | * | BGN | Yes |\n| [WebserviceX](http://www.webservicex.net) | * | * | No |\n| [1Forge](https://1forge.com) | * (free but limited or paid) | * (free but limited or paid) | No |\n| [Cryptonator](https://www.cryptonator.com) | * Crypto (Limited standard currencies) | * Crypto (Limited standard currencies)  | No |\n| [CurrencyDataFeed](https://currencydatafeed.com) | * (free but limited or paid) | * (free but limited or paid) | No |\n| [Open Exchange Rates](https://openexchangerates.org) | USD (free), * (paid) | * | Yes |\n| [Xignite](https://www.xignite.com) | * | * | Yes |\n| [Currency Converter API](https://www.currencyconverterapi.com) | * | * | Yes (free but limited or paid) |\n| [xChangeApi.com](https://xchangeapi.com) | * | * | Yes |\n| [fastFOREX.io](https://www.fastforex.io) | USD (free), * (paid) | * | No |\n| [exchangerate.host](https://www.exchangerate.host) | * | * | Yes |\n| Array | * | * | Yes |\n\nAdditionally, you can add your own services as long as they implement the `ExchangeRateService` interface.\n\n## Integrations\n\n- A Symfony Bundle [FlorianvSwapBundle](https://github.com/florianv/FlorianvSwapBundle)\n- A Laravel Package [florianv/laravel-swap](https://github.com/florianv/laravel-swap)\n\n## Credits\n\n- [Florian Voutzinos](https://github.com/florianv)\n- [All Contributors](https://github.com/florianv/swap/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](https://github.com/florianv/swap/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianv%2Fswap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianv%2Fswap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianv%2Fswap/lists"}