mews/tcmb-doviz

TCMB Güncel Döviz Kurları

2.0.1 2018-08-14 14:21 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:13:53 UTC


README

TCMB webservisini (http://www.tcmb.gov.tr/kurlar/today.xml) kullanarak güncel döviz kurlarını almaya yarar.

Kurulum

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

Kullanım

$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'));

Örnek

Örnek kodlar example/index.php dosyasında yer almaktadır.

Lisans

MIT