diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-23 00:24:50 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-23 00:24:50 +0200 |
commit | 4dd1a344c6474087a3f8782dd54f5c7b4acc67ed (patch) | |
tree | 7a0229eb721d81c7579a7f5f721a503136c98095 /db/currencies/currencies.php | |
parent | dbcd0118863ff3e7c5bee45041ccdb757eb2f366 (diff) |
area connections and town maps
Diffstat (limited to 'db/currencies/currencies.php')
-rw-r--r-- | db/currencies/currencies.php | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/db/currencies/currencies.php b/db/currencies/currencies.php deleted file mode 100644 index 7c8b2ac..0000000 --- a/db/currencies/currencies.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -$currencySymbols = []; -$handle = fopen('https://raw.githubusercontent.com/bengourley/currency-symbol-map/master/map.js', 'r'); -while ($line = fgets($handle)) { - preg_match("/(\w+): '(.+)'/", $line, $match); - - if (isset($match[1])) { - $currencySymbols[$match[1]] = $match[2]; - } -} - -$currencyNames = json_decode(file_get_contents('https://openexchangerates.org/api/currencies.json'), true); - -$decimals = [ - 'JPY' => 0, -]; - -$currencies = []; -$apiResponse = json_decode(file_get_contents('https://api.frankfurter.app/latest?base=eur'), true); -$currencies['last_updated'] = $apiResponse['date']; -foreach ($apiResponse['rates'] as $code => $rate) { - $currencies['map'][$code] = [ - 'rate' => $rate, - 'symbol' => $currencySymbols[$code], - 'name' => $currencyNames[$code], - 'decimals' => $decimals[$code] ?? 2, - ]; -} - -// add EUR -$currencies['map']['EUR'] = [ - 'rate' => 1, - 'symbol' => $currencySymbols['EUR'], - 'name' => $currencyNames['EUR'], - 'decimals' => 2, -]; - -file_put_contents( - dirname(__DIR__) . '/_generated/currencies.json', - json_encode($currencies) -); |