Skip to content

Releases: UniRate-API/drupal-unirate

Release list

v0.1.0

Choose a tag to compare

@rob-browncc rob-browncc released this 05 Jul 05:36

v0.1.0 — initial release

Drupal 10.3 / 11 module providing currency exchange rate data from the UniRate API.

Features

  • Injectable unirate.client service (UniRateClient) — use exchange rate data anywhere in your Drupal code
  • Currency Rate Block — display a live rate in any block region, configurable from/to currencies
  • Admin settings form at /admin/config/services/unirate-currency
  • API key falls back to UNIRATE_API_KEY environment variable if not set in config
  • Zero runtime PHP dependencies beyond Drupal core (uses Drupal's built-in Guzzle HTTP client)

Methods

$client->getRate('USD', 'EUR');            // float
$client->getRates('USD');                  // array<string, float>
$client->convert(100.0, 'USD', 'EUR');     // float
$client->listCurrencies();                 // array<string, string>

All methods throw UniRateException on failure.

Tests

31 PHPUnit unit tests, 45 assertions — PHP 8.1 / 8.2 / 8.3 / 8.4 all green.

Install

composer require unirate-api/unirate-drupal
drush en unirate

Get a free API key at unirateapi.com.