PHP code example of samiax / bank-exchange-rates

1. Go to this page and download the library: Download samiax/bank-exchange-rates library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

samiax / bank-exchange-rates example snippets




try {
    $rates = (new \Ahmeti\BankExchangeRates\Service)->get();
    print_r($rates);
    
}catch (\Exception $exception){
    print_r($exception);
}

[
  "USD/TRY" => [
    [
      "name" => "Garanti",
      "symbol" => "USD/TRY"
      "buy" => 18.463
      "sell" => 19.063
      "time" => "2023-01-06 00:00:37"
      "description" => "Amerikan Doları (us/tr)"
    ],
    [
      "name" => "Yapı Kredi",
      "symbol" => "USD/TRY"
      "buy" => 18.70675
      "sell" => 18.94574
      "time" => "2023-01-06 00:16:08"
      "description" => null
    ]
  ]
  
  "EUR/TRY" => [
    [
      "name" => "Garanti",
      "symbol" => "EUR/TRY"
      "buy" => 19.427
      "sell" => 20.059
      "time" => "2023-01-06 00:00:37"
      "description" => "Avrupa Para Birimi (eu/tr)"
    ],
    [
      "name" => "Yapı Kredi",
      "symbol" => "EUR/TRY"
      "buy" => 19.70949
      "sell" => 19.96007
      "time" => "2023-01-06 00:16:08"
      "description" => null
    ]
  ]
]
...