{"id":38653330,"url":"https://github.com/orkhanahmadov/currencylayer","last_synced_at":"2026-01-17T09:24:26.943Z","repository":{"id":57033068,"uuid":"209733029","full_name":"orkhanahmadov/currencylayer","owner":"orkhanahmadov","description":"PHP client for currencylayer.com","archived":false,"fork":false,"pushed_at":"2020-07-26T16:51:27.000Z","size":121,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-12T11:03:18.265Z","etag":null,"topics":["currency","currencylayer","php-client"],"latest_commit_sha":null,"homepage":null,"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/orkhanahmadov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["orkhanahmadov"]}},"created_at":"2019-09-20T07:35:53.000Z","updated_at":"2020-07-26T16:51:30.000Z","dependencies_parsed_at":"2022-08-23T20:50:28.014Z","dependency_job_id":null,"html_url":"https://github.com/orkhanahmadov/currencylayer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/orkhanahmadov/currencylayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkhanahmadov%2Fcurrencylayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkhanahmadov%2Fcurrencylayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkhanahmadov%2Fcurrencylayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkhanahmadov%2Fcurrencylayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orkhanahmadov","download_url":"https://codeload.github.com/orkhanahmadov/currencylayer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orkhanahmadov%2Fcurrencylayer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28505462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","currencylayer","php-client"],"created_at":"2026-01-17T09:24:26.782Z","updated_at":"2026-01-17T09:24:26.912Z","avatar_url":"https://github.com/orkhanahmadov.png","language":"PHP","funding_links":["https://github.com/sponsors/orkhanahmadov"],"categories":[],"sub_categories":[],"readme":"# :currency_exchange: PHP client for [currencylayer.com](https://currencylayer.com)\n\n[![Latest Stable Version](https://poser.pugx.org/orkhanahmadov/currencylayer/v/stable)](https://packagist.org/packages/orkhanahmadov/currencylayer)\n[![Latest Unstable Version](https://poser.pugx.org/orkhanahmadov/currencylayer/v/unstable)](https://packagist.org/packages/orkhanahmadov/currencylayer)\n[![Total Downloads](https://img.shields.io/packagist/dt/orkhanahmadov/currencylayer)](https://packagist.org/packages/orkhanahmadov/currencylayer)\n[![License](https://img.shields.io/github/license/orkhanahmadov/currencylayer.svg)](https://github.com/orkhanahmadov/currencylayer/blob/master/LICENSE.md)\n\n[![Build Status](https://img.shields.io/travis/orkhanahmadov/currencylayer.svg)](https://travis-ci.org/orkhanahmadov/currencylayer)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/a914e880498f0baf6b70/test_coverage)](https://codeclimate.com/github/orkhanahmadov/currencylayer/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/a914e880498f0baf6b70/maintainability)](https://codeclimate.com/github/orkhanahmadov/currencylayer/maintainability)\n[![Quality Score](https://img.shields.io/scrutinizer/g/orkhanahmadov/currencylayer.svg)](https://scrutinizer-ci.com/g/orkhanahmadov/currencylayer)\n[![StyleCI](https://github.styleci.io/repos/209733029/shield?branch=master)](https://github.styleci.io/repos/209733029)\n\nSimple PHP client for currencylayer.com currency rates.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require orkhanahmadov/currencylayer\n```\n\n## Usage\n\nInstantiate `Orkhanahmadov\\Currencylayer\\CurrencylayerClient` class and pass your \"access key\"\n\n```php\nuse Orkhanahmadov\\Currencylayer\\CurrencylayerClient;\n\n$client = new CurrencylayerClient('your-access-key-here');\n```\n\nYou can find your access key in [Currencylayer Dashboard](https://currencylayer.com/dashboard).\n\nIf you are using [paid plan](https://currencylayer.com/product), you can use HTTPS connection to currencylayer.com API.\nWhile instantiating pass `true` as second parameter to use HTTPS connection.\n\n```php\n$client = new CurrencylayerClient('your-access-key-here', true);\n```\n\n## Available methods\n\n### `quotes()`\n\nUse this method to fetch live and historical currency rates.\n\nPass source currency to `source()` method and rate currency `currency()` method.\nFollowing example will fetch live rates from USD to EUR.\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('EUR')-\u003equotes();\n```\n\nYou can also pass multiple rate currencies to `currency()` method:\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('EUR', 'AUD')-\u003equotes();\n// you can also pass currencies as an array\n$client-\u003esource('USD')-\u003ecurrency(['EUR', 'AUD'])-\u003equotes();\n```\n\nIf you want fetch rates for specific date, you can pass the date to `date()` method.\n`date()` method accepts dates as string or instance of `DateTimeInterface`.\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('EUR')-\u003edate('2019-05-20')-\u003equotes();\n```\n\n`quotes()` method returns instance of `Orkhanahmadov\\Currencylayer\\Data\\Quotes`.\nThis class has following methods that you can use:\n\n* `source()` - Returns source currency (for example, `USD`)\n* `timestamp()` - Returns timestamp value from currencylayer API (for example, `1432400348`)\n* `quotes()` - Returns array of quotes from currencylayer API\n* `date()` - Returns `DateTimeInterface` date. If you fetched live rates this method will return `null`\n\nYou can also get rates for each fetched currency using currency name as property:\n\n```php\n$quotes = $client-\u003esource('USD')-\u003ecurrency(['EUR', 'AUD'])-\u003edate('2019-05-20')-\u003equotes();\n\n$qoutes-\u003eEUR; // returns USD to EUR rate for 2019-05-20\n$qoutes-\u003eAUD; // returns USD to AUD rate for 2019-05-20\n```\n\n### `convert()`\n\nUse this method to convert amount in one currency to another currency.\n\nPass source currency to `source()` method, rate currency `currency()` method and amount to `convert()` method.\nFollowing example will convert 10 USD to GBP using live rates.\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('GBP')-\u003econvert(10);\n```\n\nIf you want conversion based on different date's rates, you can pass the date to `date()` method.\n`date()` method accepts dates as string or instance of `DateTimeInterface`.\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('GBP')-\u003edate('2019-05-20')-\u003econvert(10);\n```\n\n`convert()` method returns instance of `Orkhanahmadov\\Currencylayer\\Data\\Conversion`.\nThis class has following methods that you can use:\n\n* `fromCurrency()` - Returns source currency (for example, `USD`)\n* `toCurrency()` - Returns target currency (for example, `GBP`)\n* `timestamp()` - Returns timestamp value from currencylayer API (for example, `1432400348`)\n* `amount()` - Returns amount that passed to `convert()` method (for example, `10`)\n* `quote()` - Returns quote between source and target currencies (for example, `0.658443`)\n* `result()` - Returns conversion result (for example `6.58443`)\n* `date()` - Returns `DateTimeInterface` date. If you fetched live rates this method will return `null`\n\n### `timeframe()`\n\nUse this method to show rates between given dates.\n\nPass source currency to `source()` method, rate currencies to `currency()` method and \nstart date as first argument and end date as second argument to `timeframe()` method.\nStart and end dates can be string of dates or instances of `DateTimeInterface`.\n\nFollowing example will return timeframe rates from USD to GBP and EUR between `2010-03-01` and `2010-04-01`.\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('GBP', 'EUR')-\u003etimeframe('2010-03-01', '2010-04-01');\n```\n\n`timeframe()` method returns instance of `Orkhanahmadov\\Currencylayer\\Data\\Timeframe`.\nThis class has following methods that you can use:\n\n* `source()` - Returns source currency (for example, `USD`)\n* `startDate()` - Returns `DateTimeInterface` start date\n* `endDate()` - Returns `DateTimeInterface` start date\n* `allQuotes()` - Returns array quotes grouped by each day between start and end date\n* `quotes()` - Accepts string date or instance of `DateTimeInterface` and returns rates for that day\n\nYou can also use currency code as function call and pass date to get rates:\n\n```php\n$timeframe = $client-\u003esource('USD')-\u003ecurrency('GBP', 'EUR')-\u003etimeframe('2010-03-01', '2010-04-01');\n\n$timeframe-\u003eGBP('2010-03-15'); // returns USD to GBP rate for 2010-03-15\n$timeframe-\u003eEUR('2010-03-20'); // returns USD to EUR rate for 2010-03-20\n```\n\n### `change()`\n\nUse this method to show currency rate change between given dates.\n\nPass source currency to `source()` method, rate currencies to `currency()` method and \nstart date as first argument and end date as second argument to `change()` method.\nStart and end dates can be string of dates or instances of `DateTimeInterface`.\n\nFollowing example will return rate change from USD to GBP and EUR between `2010-03-01` and `2010-04-01`.\n\n```php\n$client-\u003esource('USD')-\u003ecurrency('GBP', 'EUR')-\u003echange('2010-03-01', '2010-04-01');\n```\n\n`change()` method returns instance of `Orkhanahmadov\\Currencylayer\\Data\\Change`.\nThis class has following methods that you can use:\n\n* `source()` - Returns source currency (for example, `USD`)\n* `startDate()` - Returns `DateTimeInterface` start date\n* `endDate()` - Returns `DateTimeInterface` start date\n* `quotes()` - Returns array of currency change rates between start and end date\n* `rate()` - Accepts currency code as an argument and returns currency rate for given start date\n* `endRate()` - Accepts currency code as an argument and returns currency rate for given end date\n* `amount()` - Accepts currency code as an argument and currency rate's change in amount\n* `percentage()` - Accepts currency code as an argument and currency rate's change in percentage\n\n### `list()`\n\nUse this method to get list of all available currencies.\n\n```php\n$client-\u003elist();\n```\n\nMethod will return array of currencies in `currencyCode =\u003e currencyName` structure.\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email ahmadov90@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Orkhan Ahmadov](https://github.com/orkhanahmadov)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forkhanahmadov%2Fcurrencylayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forkhanahmadov%2Fcurrencylayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forkhanahmadov%2Fcurrencylayer/lists"}