mews/tcmb-doviz

TCMB最新汇率

2.0.1 2018-08-14 14:21 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:20:25 UTC


README

TCMB webservisi (http://www.tcmb.gov.tr/kurlar/today.xml) 使用它来获取最新的汇率。

安装

git clone git://github.com/mewebstudio/tcmb-doviz
cd tcmb-doviz
composer install
cd example
php -S localhost:8000

使用

$currency = new \Mews\Tcmb\Currency('http://www.tcmb.gov.tr/kurlar/today.xml');

// Tümünü listeme:
$items = $currency->getItems();
foreach($items as $item) {
    echo $item->CurrencyCode . ' / ' . $item->CurrencyName . ': Alış: ' . $item->ForexBuying . ' - Satış: ' . $item->ForexBuying . '<br>';
}

// Bir kurun verisine erişim:
// USD alış:
echo $currency->getItem('USD')->ForexBuying;
// USD satış:
echo $currency->getItem('USD')->ForexSelling;

// Tüm parametrelerin dökümü:
var_dump($currency->getItem('USD'));

示例

示例代码位于 example/index.php 文件中。

许可证

MIT