Implementation of rixafy/currency to Nette Framework

v2.0.1 2022-03-21 00:16 UTC

This package is auto-updated.

Last update: 2024-05-21 04:44:12 UTC


💱 CRUD model rixafy/currency ported to @nette framework.


composer require archette/currency

Add extension to your neon configuration

    archette.currency: Archette\Currency\CurrencyExtension

    apiKey: <Your api key from>
    apiService: fixer
    baseCurrency: EUR

and then run command php bin/console rixafy:currency:update for loading currencies and their rates to database (decimal points, separators and symbols are not yet included in update script)

Example usage

Basic examples for working with extension


$eur = $this->currencyFacade->getByCode('EUR'); // returns Currency instance
$usd = $this->currencyFacade->getByCode('USD'); // returns Currency instance

$eur->convertFrom($usd, 100); // converts 100 USD to EUR, returns float
$eur->convertTo($usd, 100); // converts 100 EUR to USD, returns float

Latte filters

There are 3 basic latte filters, currency, currencyCode and currencyNumber, all 3 filters have same parameters, $amount and $currencyCode (optional)

{45.54|currency} will display $45.54 if default or provided (CurrencyProvider::provide('USD')) currency is USD

{45.54|currency:'EUR'} will display 45,54 €

{45.54|currencyCode:'EUR'} will display 45,54 EUR

{45.54|currencyNumber:'EUR'} will display 45,54

decimal point, hundred and thousand separator, symbol and code is saved in DB (table currency)


Extension requires implementation of Doctrine ORM in Nette Framework -

Extension requires implementation of symfony/console in Nette Framework -