alexanderc/exchange-rates

此包已被废弃且不再维护。没有建议的替代包。

一个库,使用不同的提供商解析不同国家的汇率

v1.1.1 2015-04-10 09:16 UTC

This package is not auto-updated.

Last update: 2020-10-20 13:07:55 UTC


README

一个库,使用不同的提供商解析不同国家的汇率

##要求## 查看 composer.json

##安装##

  • 安装 Composer
  • composer.json 的 require 部分添加:"alexanderc/exchange-rates": "dev-master"
  • 运行 composer.phar installcomposer.phar update

##可用提供商##

  • 摩尔多瓦共和国

##基本用法##

require 'vendor/autoload.php';

use ExchangeRates\Client;

$client = Client::create('curs_md');

foreach($client->parse(new \DateTime()) as $rate) {
    echo sprintf(
        "%s (%s), %s: %s=%.2f%s\n",
        $rate->getCountry(),
        $rate->getBank(),
        $rate->getHumanizedType(),
        $rate->getMainCurrency(),
        $rate->getExchangeRate(),
        $rate->getLocalCurrency()
    );
}

查看 https://github.com/AlexanderC/ExchangeRates/blob/master/tests/basic.php 获取更多示例

##待办事项##

  • 单元测试
  • 添加更多提供商

##许可证##

  • Apache v2.0

##赞助商##