Skip to content

UniRate-API/unirate-currency-converter

Repository files navigation

unirate-currency-converter

WordPress plugin — live currency conversion in posts, pages, and blocks. Powered by UniRate API.

Features

  • Gutenberg block — drag-and-drop currency converter with block-editor sidebar controls.
  • Three shortcodes[unirate_rate], [unirate_convert], [unirate_widget].
  • API key stays server-side — requests are proxied through /wp-json/unirate/v1/; the key is never exposed to visitors.
  • WP transient caching — 1-hour cache out of the box, zero extra database writes per page load.
  • Zero PHP runtime dependencies — uses wp_remote_get() only; no Composer packages needed on your server.

Installation

  1. Download the plugin zip from Releases and upload via Plugins → Add New → Upload Plugin, or install directly from the WordPress Plugin Directory.
  2. Activate via Plugins → Installed Plugins.
  3. Go to Settings → UniRate and enter your UniRate API key.

Shortcodes

[unirate_rate from="USD" to="EUR"]

Server-rendered exchange rate at page load.

1 USD = 0.9235 EUR

[unirate_convert from="USD" to="EUR" amount="100"]

Server-rendered converted amount.

92.35 EUR

[unirate_widget from="USD" to="EUR" amount="1"]

Interactive currency converter. Visitor enters an amount, clicks Convert, and the result loads instantly via the local REST proxy — no API key exposed.

Gutenberg block

Search for UniRate Currency Converter in the block inserter (Widgets category). Use the sidebar panel to set:

  • Display style — widget / rate / converted amount
  • From / To currency — 3-letter ISO codes
  • Amount

REST endpoints

The plugin registers these endpoints on your site (all GET, public):

Endpoint Params Response
/wp-json/unirate/v1/rate from, to {"rate": 0.9235}
/wp-json/unirate/v1/convert from, to, amount {"result": 92.35}
/wp-json/unirate/v1/currencies {"currencies": ["USD", "EUR", ...]}

Your API key is read from wp_options server-side — it never appears in these responses or in page HTML.

Development

# Install test dependencies (runs in an isolated container)
dev php composer install

# Run tests
dev php ./vendor/bin/phpunit

# Offline re-run (post-install security check)
dev --no-net php ./vendor/bin/phpunit

Tests: 37 tests, 52 assertions (ClientTest · SettingsTest · RestApiTest · ShortcodeTest via WP_Mock + PHPUnit 9.6).

Related packages

Package Description
unirate-api Node.js client
unirate-api Python client
@unirate/react React hooks
@unirate/next Next.js integration
@unirate/nuxt Nuxt module
@unirate/sveltekit SvelteKit integration
flask-unirate Flask extension
djangorestframework-unirate Django REST Framework
jekyll-unirate Jekyll plugin
hugo-unirate Hugo module
@unirate/astro Astro integration
@unirate/mcp MCP server
unirate-cli CLI tool

UniRate ecosystem

UniRate ships official integrations for 40+ ecosystems, all maintained under the UniRate-API org.

Core clients (9 languages) Python · Node.js / TypeScript · Go · Rust · Java · Ruby · PHP · .NET · Swift

JavaScript / TypeScript React · Next.js · Remix · SvelteKit · Vue · Angular · Nuxt · NestJS · tRPC

Static-site generators Astro · Eleventy · Hugo · Jekyll

CMS & e-commerce Wagtail · WordPress · WooCommerce · Drupal · Strapi · Medusa · Symfony · Laravel · Directus

Data, AI & backend LangChain (Python) · LangChain.js · FastAPI · Flask · Django REST Framework · Apache Airflow · dbt

Platform & tools MCP server · CLI · Cloudflare Workers · Home Assistant · n8n · Google Sheets · VS Code · Obsidian

Money library bridges money gem (Ruby) · NodaMoney (.NET)

Get a free API key at unirateapi.com.

License

MIT

About

WordPress plugin — live currency conversion in posts, pages, and blocks. Powered by UniRate API.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors