PHPackages                             ionut/currency - 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. ionut/currency

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ionut/currency
==============

Framework-agnostic currency conversion based on the European Central Bank rates. Integrates seamlessly with Laravel.

0.1.4(10y ago)63.4k↓100%MITPHP

Since Jan 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/IonutBajescu/currency)[ Packagist](https://packagist.org/packages/ionut/currency)[ RSS](/packages/ionut-currency/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

Ionut\\Currency
===============

[](#ionutcurrency)

[![Latest Stable Version](https://camo.githubusercontent.com/34ac287784013c8beb2d94df5a6e2ddc43c2ba938baed4888a15e0e7c0740145/68747470733a2f2f706f7365722e707567782e6f72672f696f6e75742f63757272656e63792f762f737461626c652e737667)](https://packagist.org/packages/ionut/currency)[![Build Status](https://camo.githubusercontent.com/5aba672e564f2e286857e1b1c5c4a015e6361274f42deec29eb4eae9a4703320/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f496f6e757442616a657363752f63757272656e63792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/IonutBajescu/currency)[![Coverage Status](https://camo.githubusercontent.com/b21e6b02f9b3590e80adf0e1e1f8d8083d75a1c5447e1c866d6ff3515c948d2d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f496f6e757442616a657363752f63757272656e63792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/IonutBajescu/currency/code-structure)[![Quality Score](https://camo.githubusercontent.com/9ef02bf29654649f06d7af19f5ccffc31317c117b726255e9edc06b5fcd6d40e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f496f6e757442616a657363752f63757272656e63792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/IonutBajescu/currency)[![Total Downloads](https://camo.githubusercontent.com/1978e80da3ee36ca836f23aab05c3936b64361f2f4697fcd2da232749a9b5a32/68747470733a2f2f706f7365722e707567782e6f72672f696f6e75742f63757272656e63792f642f746f74616c2e737667)](https://packagist.org/packages/ionut/currency)[![License](https://camo.githubusercontent.com/93819fa4d531f82e28fa792becc0a0750419726623c7e82e82b21bcbe97836f5/68747470733a2f2f706f7365722e707567782e6f72672f696f6e75742f63757272656e63792f6c6963656e73652e737667)](https://packagist.org/packages/ionut/currency)

Currency is a currency exchanger written in PHP that aims for ease of use and complete independence of any frameworks or CMSs.

Besides being fully unit-tested and well written, it is also one of the few libraries(if not the only) that uses the European Central Bank rates. This does not only mean that you get the conversion rates for free but also that you do not tie one of the core responsibilities of your application to a fragile third-party service.

So far, it provides an out of the box service provider for Laravel. But besides that, the library is completely framework agnostic and it'll stay like this for the foreseeable future.

Starting out
------------

[](#starting-out)

Some applications do not need the complexity and verbosity of our OOP endeavours. For those, currency has a clean helper that would love to help you keep your code short.

Let's say you want to convert $20.5 to EUR by using the latest rates provided by the European Central Bank, the code accomplishing that will look like this:

```
$eurAmount = currency(20.5, 'USD')->toEUR();
```

Gain control of the exchanger's building
----------------------------------------

[](#gain-control-of-the-exchangers-building)

In case you don't fancy having helpers in your codebase you'll be happy to know that using the helper function is optional. Let's just rewrite the previous example and get rid of the helper:

```
$exchanger = (new Ionut\Currency\Factory)->create();

$usdAmount = new Amount(20.5, 'USD');
$eurAmount = $exchanger->convert($usdAmount, 'EUR');
```

Of course, there's more code to write by using this approach. But such level of control couldn't be readily accomplished by using the helper function.

Intermediate Usage
------------------

[](#intermediate-usage)

As seen in the previous example, there are three distinct parts which form the core of the Currency library:

 Exchanger The guy that converts the numbers by applying first grade math. ExchangeRates *Whose implementation is the EuropeanCentralBank guy in the example.*
It provides the exchanger with the latest exchange rates. Downloader The guy that comes and helps ExchangeRates by downloading files and caching them locally. (for example an XML containing the exchange rates)By remembering those and keeping in mind that the library fully follows the interfaces found in the `Contracts` namespace, you should be able to master everything there is to know about this library.

Contracts
---------

[](#contracts)

Because libraries die more often that one would expect, Currency provides the developer with Contracts for every of the Currency's class, allowing his code to remain SOLID while using the best currency conversion library there is.

Tests
-----

[](#tests)

The present library is fully unit-tested, contributors are welcome to check the aforementioned tests in the `tests` folder and run them by calling PHPUnit.

License
-------

[](#license)

The present package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~19 days

Total

5

Last Release

3675d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/63223808dc23494472294895dde59871648108606e9ac68f644be09472dc5b43?d=identicon)[ionut](/maintainers/ionut)

---

Top Contributors

[![IonutBajescu](https://avatars.githubusercontent.com/u/5365516?v=4)](https://github.com/IonutBajescu "IonutBajescu (22 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ionut-currency/health.svg)

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

###  Alternatives

[mkusher/padawan

Smart php completion server

2547.2k](/packages/mkusher-padawan)[pdir/social-feed-bundle

Social feed extension for Contao CMS

1414.8k](/packages/pdir-social-feed-bundle)[eljam/circuit-breaker

A php Circuit Breaker

1711.0k1](/packages/eljam-circuit-breaker)[jandc/css-from-html-extractor

Php library which determines which css is used from html snippets.

1028.7k1](/packages/jandc-css-from-html-extractor)[php-di/zf2-bridge

Integrates PHP-DI to Zend Framework 2

1118.4k](/packages/php-di-zf2-bridge)[antares/accessible

PHP library that allows you to define your class' getters, setters and constructor with docblock annotations.

123.9k1](/packages/antares-accessible)

PHPackages © 2026

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