cryonighter/currency-converter
最新稳定版本:1.0.0
Composer 安装命令:
composer require cryonighter/currency-converter
包简介
This package allows you to convert exchange rates according to the rate of the Central Bank of Russia (but you can use any other sources of exchange rates)
README 文档
README
This package allows you to convert exchange rates according to the rate of the Central Bank of Russia (but you can use any other sources of exchange rates)
Highlights
System Requirements
You need:
- PHP >= 8.1.0 but the latest stable version of PHP is recommended
Install
Via Composer
$ composer require cryonighter/currency-converter
Usage
use Cryonighter\CurrencyConverter\CurrencyCodeConverter; use Cryonighter\CurrencyConverter\CurrencyConverter; use Cryonighter\CurrencyConverter\Provider\CbrCurrencyRateProvider; // Get a list of exchange rates. By default, the package provides a service for receiving rates from the server of the Central Bank of Russia. // However, you can use any source of currency rates, you only need to form an array of instances of the CurrencyRate class. $currencyRates = CbrCurrencyRateProvider::getCurrencyRates(); // Build the converter object $currencyConverter = new CurrencyConverter(new CurrencyCodeConverter(), $currencyRates); // To convert 100 USD to EUR $amount = $currencyConverter->convert(100, 'USD', 'EUR'); // You can also use numeric currency codes $amount = $currencyConverter->convert(100, '840', '978'); // You can mix and match :) $amount = $currencyConverter->convert(100, '840', 'EUR');
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ php vendor/phpunit/phpunit/phpunit tests
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email cryonighter@yandex.ru instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 452
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-07