PHPackages                             ongr/currency-exchange-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ongr/currency-exchange-bundle

Abandoned → [ongr/currency-exchange-bundle](/?search=ongr%2Fcurrency-exchange-bundle)Symfony-bundle[Utility &amp; Helpers](/categories/utility)

ongr/currency-exchange-bundle
=============================

ONGR currency exchange bundle

v2.0.6(9y ago)35.6k4MITPHPPHP &gt;=5.5

Since Jan 30Pushed 9y ago18 watchersCompare

[ Source](https://github.com/ongr-io/CurrencyExchangeBundle)[ Packagist](https://packagist.org/packages/ongr/currency-exchange-bundle)[ Docs](http://ongr.io)[ RSS](/packages/ongr-currency-exchange-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (14)Used By (0)

ONGR Currency Exchange Bundle
=============================

[](#ongr-currency-exchange-bundle)

This bundle provides an easy way to display price in multiple currencies. It gives a solution to fetch and store current currency rates, to convert prices and display them in Twig templates.

[![Stable Release](https://camo.githubusercontent.com/6933ed5193f458c9ab678c6f908b629084b1061d556ac9e02fe9401831daad6d/68747470733a2f2f706f7365722e707567782e6f72672f6f6e67722f63757272656e63792d65786368616e67652d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/ongr/currency-exchange-bundle)[![Build Status](https://camo.githubusercontent.com/8cf240ed55f4204bc42fcc9e25597a1e58b72beeea32dbd924ccf3626b9a7674/68747470733a2f2f7472617669732d63692e6f72672f6f6e67722d696f2f43757272656e637945786368616e676542756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ongr-io/CurrencyExchangeBundle)[![Coverage Status](https://camo.githubusercontent.com/04e0ed15dcc0ad1be2a20b17903b0d4e51a423094abb7b4fc95943a1dd147bc6/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f6e67722d696f2f43757272656e637945786368616e676542756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/ongr-io/CurrencyExchangeBundle?branch=master)[![Quality Score](https://camo.githubusercontent.com/5f2917fc847859f3d5cc2c8355711e7046d17937ffff50f05f009b9b81d102d3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f6e67722d696f2f43757272656e637945786368616e676542756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ongr-io/CurrencyExchangeBundle/?branch=master)

Documentation
-------------

[](#documentation)

The documentation of the bundle can be found in [Resources/doc/](Resources/doc/index.md)

Installation
------------

[](#installation)

Follow 5 quick steps to setup this bundle.

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require ongr/currency-exchange-bundle
```

> This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Register bundles in `app/AppKernel.php`:

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        return [
            // ...
            new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
            new ONGR\CurrencyExchangeBundle\ONGRCurrencyExchangeBundle(),
        ];
    }

    // ...
}
```

### Step 3: Update Elasticsearch Mapping

[](#step-3-update-elasticsearch-mapping)

This bundle provides Elasticsearch document to store currency rates. Add this bundle to your ES manager's mapping to associate it:

```
# app/config/config.yml
ongr_elasticsearch:
    # ...
    managers:
        default:
            # ...
            mappings:
                # ...
                - AppBundle
                - ONGRCurrencyExchangeBundle
```

### Step 4: Configure the Bundle

[](#step-4-configure-the-bundle)

Configure the currencies you need in `config.yml` file.

```
# app/config/config.yml
ongr_currency_exchange:
    es_manager: default
    default_currency: EUR
    separators:
        decimal: ','
        thousands: '.'
    currencies:
        EUR: "%s €"    # %s stands for the price itself
        USD: "$ %s"
```

That's it for setup, jump to the next chapter to learn how to use this bundle.

Usage
-----

[](#usage)

The main parts of this bundle are a command to update currency rates and Twig helpers to display price in various currencies.

Before converting prices you need to fetch the latest currency rates:

```
$ app/console ongr:currency:update
```

> **Tip:** setup a cron job to update currencies daily in your production environment.

Now you are ready to use currency conversion logic in your templates. Here is a simple example how to convert currency:

```

    Price in default currency: {{ 123.123|ongr_price(2) }}
    Price in US dollars: {{ 123.123|ongr_price(2, 'USD') }}

```

In this example the number 2 represents the number of decimal points. It will print the following information:

```
Price in default currency: 123.12 €
Price in US dollars: $ 123.12

```

To learn more read about provided [Twig helpers](Resources/doc/twig_helpers.md) or check [example currency switching](Resources/doc/switching_currency.md) implementation.

License
-------

[](#license)

This package is licensed under the MIT license. For the full copyright and license information, please view the [LICENSE](LICENSE) file that was distributed with this source code.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 51.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~6 days

Total

12

Last Release

3568d ago

Major Versions

v0.2.0 → v1.0.02016-06-06

1.0.x-dev → v2.0.02016-07-04

PHP version history (2 changes)v0.1.0PHP &gt;=5.4

v1.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/ba19b8a6d1e37d323b0177ce8d9baf4a65eb4f2cf027e991a2f7c3843fb22c60?d=identicon)[saimaz](/maintainers/saimaz)

---

Top Contributors

[![saimaz](https://avatars.githubusercontent.com/u/115824?v=4)](https://github.com/saimaz "saimaz (43 commits)")[![einorler](https://avatars.githubusercontent.com/u/13484571?v=4)](https://github.com/einorler "einorler (18 commits)")[![mvar](https://avatars.githubusercontent.com/u/1286752?v=4)](https://github.com/mvar "mvar (8 commits)")[![trandangtri](https://avatars.githubusercontent.com/u/7868214?v=4)](https://github.com/trandangtri "trandangtri (7 commits)")[![tomaspocevicius](https://avatars.githubusercontent.com/u/2837127?v=4)](https://github.com/tomaspocevicius "tomaspocevicius (4 commits)")[![rolandaszelionka](https://avatars.githubusercontent.com/u/11957829?v=4)](https://github.com/rolandaszelionka "rolandaszelionka (1 commits)")[![nakedmnd](https://avatars.githubusercontent.com/u/816991?v=4)](https://github.com/nakedmnd "nakedmnd (1 commits)")[![kazysgurskas](https://avatars.githubusercontent.com/u/12516828?v=4)](https://github.com/kazysgurskas "kazysgurskas (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ongr-currency-exchange-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ongr-currency-exchange-bundle/health.svg)](https://phpackages.com/packages/ongr-currency-exchange-bundle)
```

###  Alternatives

[pdir/social-feed-bundle

Social feed extension for Contao CMS

1414.8k](/packages/pdir-social-feed-bundle)[anime-db/anime-db

The application for making home collection anime

252.1k2](/packages/anime-db-anime-db)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
