Skip to content

Commit

Permalink
Migrate to new version of fawazahmed0's currency API
Browse files Browse the repository at this point in the history
Due to fawazahmed0/exchange-api#89, the old API is down and doesn't work
anymore. This PR migrates it to use the newer API as documented in
https://github.com/fawazahmed0/exchange-api/blob/main/MIGRATION.md.
  • Loading branch information
quantum5 committed Jul 18, 2024
1 parent ab461e1 commit abea00c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vendor/chetcuti/gjclasses/src/GJClasses/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public function getConvRate($from_currency, $to_currency)
$from_currency = strtolower($from_currency);
$to_currency = strtolower($to_currency);

$full_url = 'https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/' . $from_currency . '/' . $to_currency . '.json';
$full_url = 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/' . $from_currency . '.json';
$remote = new Remote();
$result = $remote->getFileContents($full_url);
if ($result === false) return false;
$json_result = json_decode($result, true);
$conversion_rate = $json_result[$to_currency];
$conversion_rate = $json_result[$from_currency][$to_currency];

} elseif ($this->source === 'fixer') {

Expand Down

0 comments on commit abea00c

Please sign in to comment.