Skip to content

Retrieves Swiss Franc exchange rates for foreign currencies based on data from the website of the Swiss Federal Customs Administration.

License

Notifications You must be signed in to change notification settings

mrcage/chf-exchange-rates-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swiss Franc exchange rate query library for PHP

Retrieves Swiss Franc exchange rates for foreign currencies based on data from the website of the Swiss Federal Customs Administration.

https://www.estv.admin.ch/estv/en/home/value-added-tax/accounting-vat/vat-foreign-exchange-rates.html

The library uses internal caching of requested data (cache time is one week).

Usage

Include class

use MrCage\EzvExchangeRates\EzvExchangeRates;

Get exchange rate for current day

$rate = EzvExchangeRates::getExchangeRate('EUR');

Get exchange rate for a day in the past

The date must be specified as Carbon date object.

$rate = EzvExchangeRates::getExchangeRate('USD', Carbon::yesterday());

Get all available currencies

$currencies = EzvExchangeRates::listCurrencies();

This will return a list of currency codes as an array, the key being the (uppercase) currency code, and the value being the base value used for the exchange rate.

About

Retrieves Swiss Franc exchange rates for foreign currencies based on data from the website of the Swiss Federal Customs Administration.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages