PHP Library for currency conversion using CurrencyConverterAPI
- src folder with a php file that you should include in your project
- tests folder with php unit tests using PHPUnit
Because it's free, you do not need an API Key or subscribe and works good. You have 100 requests per hour. However, the library uses a local cache, so if you use the same instance in your script you won't use your hourly-requests. Bear in mind the cache do not have an expiration time.
If you want more, you can get a paid plan.
Find pricing and documentation in their website.
$cc = new ConverterCurrency();
$cc->convert(string $from, string $to, float $amount)
This example will return USD 10,000 in BTC
$cc = new ConverterCurrency();
$cc->convert("USD", "BTC", 10000);
Install PHPUnit, then:
phpunit test_CurrencyConverter.php
Feel free to use this code. If you need to contact me, you can do it a sperez at est.frba.utn.edu.ar