Drupal is a registered trademark of Dries Buytaert

convert_currencies

2 sites No security coverage
View on drupal.org

Convert Currencies

Convert Currencies is a robust, modern Drupal 9/10/11 module for real-time currency conversion and management. It provides a user-friendly admin interface, developer-friendly services, and a flexible architecture designed for extensibility and future-proofing.

🚀 Features

  • Real-time Exchange Rates: Automatic updates via the Fixer API (free plan supported)
  • Smart Cron System: Configurable update intervals (15min to daily) using Drupal’s built-in cron
  • Multiple Currency Support: Easily add, remove, or manage any ISO 4217 currency
  • Admin UI: Intuitive configuration and management at /admin/config/fixer_currencies
  • Developer API: Simple service for converting prices in custom code
  • Cache Management: Automatic cache invalidation for up-to-date data
  • Rate Limiting: Prevents excessive API calls
  • Error Handling: Comprehensive logging and user feedback
  • Drupal 11 Compatible: Built with modern PHP and Drupal standards

⚡ Quick Start

  1. Install and enable the module (Composer or manually)
  2. Get a free API key from Fixer.io
  3. Go to /admin/config/fixer_currencies and enter your API key
  4. Add the currencies you need (using ISO 4217 codes)
  5. Set your base currency and update interval
  6. Run cron or wait for automatic updates

🛠️ Why Fixer API?

The Fixer API is a reliable, developer-friendly service with a generous free tier. The module is architected to allow for additional providers in the future—contributions are welcome!

💻 Developer Usage

Use the provided service for conversions:

$converter = \Drupal::service('convert_currencies.converter');
$amountInEur = $converter->convert(100, 'usd', 'eur');

All features are available via dependency injection for custom modules.

🔄 Extensibility

The codebase is designed for easy extension:
The conversion service is decoupled and can be refactored to support multiple providers.
Adding a new API source would involve implementing a new provider class and updating the service to use it (see TODO.md for roadmap).

❓ FAQ

Can I use a different API provider?

Not yet, but the code is structured for easy extension. Multi-provider support is on the roadmap.

Why is my base currency locked to EUR?

The free Fixer API plan only supports EUR as the base currency.

How do I force an immediate update?

Run cron or use Drush: drush cron

What happens if the API is down?

The module logs an error and keeps the last known rates.

💡 Example Use Cases

E-commerce sites needing up-to-date product prices in multiple currencies
Financial dashboards displaying real-time exchange rates
Custom blocks or pages showing currency conversions for users

🔐 Permissions

Administer currencies: Required to manage currencies, conversion rates, and Fixer API settings.

🗑️ Uninstall

Disable the module via the admin UI or Drush: drush pmu convert_currencies
All configuration and currency entities are removed automatically—no manual cleanup required.

🏆 Comparison with Currency module

Convert Currencies focuses on:

  • Simplicity and modern code
  • Real-time rates via Fixer API
  • Easy admin UI and developer API
  • Designed for extensibility (multi-provider support planned)

Currency module offers:

  • Extensive multi-currency support
  • Integration with Drupal Commerce
  • More complex configuration and features

Can they both be used?

Yes! If you need a lightweight, modern, and easily extendable solution for real-time rates, use Convert Currencies.
If you need deep integration with Commerce or advanced multi-currency workflows, Currency may be a better fit.

🧪 Testing

Unit tests included (run via Drupal UI or PHPUnit)
Kernel and functional tests planned

⚠️ Known Limitations

  • Only EUR as base currency (Fixer API free plan limitation)
  • Only Fixer API supported (multi-provider support planned)
  • No historical rate tracking (planned)
  • No currency symbol/formatting support (planned)
  • No REST or GraphQL endpoints (planned)
  • No multi-language support for currency names (planned)

Next Steps

If you want to add multi-provider support, see the TODO.md and consider contributing a provider interface and a new provider class.
For any issues or feature requests, use the Drupal.org issue queue.

Built with ❤️ for the Drupal community

Activity

Total releases
1
First release
Jul 2025
Latest release
7 months ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.1 Stable Jul 20, 2025