sibyx / ecb-reference-rates-parser
A simple library for parsing reference rates from European Central Bank open XML API
1.0.0
2021-05-26 11:57 UTC
Requires
- php: >=5.4
- lib-curl: *
- lib-libxml: *
This package is auto-updated.
Last update: 2024-11-26 19:43:00 UTC
README
A simple PHP library for parsing current reference rates from European Central Bank stored in remote XML file.
Installation
composer install sibyx/ecb-reference-rates-parser
Usage example
<?php use EcbReferenceRates\EcbReferenceRatesParser; require 'vendor/autoload.php'; /** @var \EcbReferenceRates\Models\RateReference $list */ $list = EcbReferenceRatesParser::parse(); printf("Data from %s\n", $list->getDate()->format("Y-m-d")); printf("JSON representation of RateReference object: %s\n", json_encode($list)); printf("\n"); /** @var \EcbReferenceRates\Models\Rate $rate */ foreach ($list->getRates() as $rate) { printf("Currency: %s\n", $rate->getCurrency()); printf("Rate: %f\n", $rate->getRate()); printf("String representation of Rate object: %s\n", $rate); printf("JSON: %s\n", json_encode($rate)); printf("\n"); }
Contributors
- Jakub Dubec - Initial works, maintenance
I wrote this library as part of my job in Backbone s.r.o..
License
This project is licensed under the terms of the MIT license.