ilknur-dogan/exchange-rate
最新稳定版本:v1.0.1
Composer 安装命令:
composer require ilknur-dogan/exchange-rate
包简介
Exchange rate transformation package
README 文档
README
This library is designed to fetch exchange rates from the Central Bank of the Republic of Turkey (TCMB) and perform currency conversions for specific dates.
Installation
You can install this library using Composer.
composer require ilknur-dogan/exchange-rate
Usage
1. Fetching Exchange Rates
You can use the getRate method to retrieve exchange rates for a specific date.
getRate($date)
- Returns exchange rates for the specified date as an array.
- $date: The date for which exchange rates are to be retrieved (in YYYY-MM-DD format).
require 'vendor/autoload.php'; use IlknurDogan\ExchangeRate\ExchangeRate; $exchangeRate = new ExchangeRate(); $rates = $exchangeRate->getRate('2024-08-01'); // Example date print_r($rates);
2. Currency Conversion
You can use the convert method to perform a currency conversion between two currencies for a specific date.
convert($date, $from, $to)
- Returns the conversion rate between the two currencies for the specified date (as a string).
- $date: The date for which the exchange rate is to be used (in YYYY-MM-DD format).
- $from: The currency to be converted from (e.g., USD).
- $to: The currency to be converted to (e.g., EUR).
require 'vendor/autoload.php'; use IlknurDogan\ExchangeRate\ExchangeRate; $exchangeRate = new ExchangeRate(); $convertedAmount = $exchangeRate->convert('2024-08-01', 'USD', 'EUR'); // Example date and currencies echo $convertedAmount;
License
This package is open source software licensed under the MIT License.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-06