PHPackages                             gocanto/converter - 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. gocanto/converter

ActivePhp-bundle[Utility &amp; Helpers](/categories/utility)

gocanto/converter
=================

Immutable PHP currency converter that's data-agnostic.

1.0.0(7y ago)775476MITPHPPHP ^7.2CI failing

Since Jun 10Pushed 7y ago5 watchersCompare

[ Source](https://github.com/gocanto/converter)[ Packagist](https://packagist.org/packages/gocanto/converter)[ Docs](https://github.com/gocanto/converter)[ RSS](/packages/gocanto-converter/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (11)Versions (3)Used By (0)

About it
--------

[](#about-it)

[![Total Downloads](https://camo.githubusercontent.com/b1778cd02ceee9dfb36b80a07a8ca6bbb31655c9d08b5c1a4d37a2018d392516/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f63616e746f2f636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gocanto/converter)[![Latest Stable Version](https://camo.githubusercontent.com/85c18f769c419e57c2216c996e0224d81e82a8acea57f76f10588ae77a3f4dbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f676f63616e746f2f636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gocanto/converter)[![Build status](https://camo.githubusercontent.com/254d61ed17b5a47ea59b84d4813c81722329e3e839a260337d834f0276deafd1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f676f63616e746f2f636f6e7665727465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/gocanto/converter)

The converter library is a `immutable` drop in currencies converter that's data-agnostic..

In order for it to work, you will have to pass your repository data look up to pull in a valid information to operate on. This repository has to implement the interface `CurrenciesRepositoryInterface` [shipped](https://github.com/gocanto/converter/blob/master/src/Interfaces/CurrenciesRepositoryInterface.php) with the library

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

[](#installation)

This library uses [Composer](https://getcomposer.org) to manage its dependencies. So, before using it, make sure you have it installed in your machine. Once you have done this, you will be able to pull this library in by typing the following command in your terminal.

```
composer require gocanto/converter

```

Data layer implementation
-------------------------

[](#data-layer-implementation)

First of all, you will have to create a repository to query either your database or any other data resources where you keep your application currencies information. [see example](https://github.com/gocanto/converter/blob/master/examples/CurrenciesRepositoryExample.php)

Second of all, you will have to new up the converter passing an instance of the mentioned interface repository implementation. Like so:

```
use Gocanto\Converter\Examples\CurrenciesRepositoryExample;
use Gocanto\Converter\Converter;

$repository = new CurrenciesRepositoryExample;
$converter = new Converter($repository);
```

> Note: You can bind this interface within your app service container to have automatic dependencies injection resolution.

Lastly, you just need to invoke the required methods within the converter object to set the proper values for a given currency conversion (currency from, currency to). Like so:

```
use Gocanto\Converter\RoundedNumber;

$conversion = $converter
    ->withAmount(RoundedNumber::make(10))
    ->withCurrency('SGD')
    ->convertTo('USD');
```

> This operation will return a Currency Conversion object that holds all the related operations info

Contributing
------------

[](#contributing)

Please feel free to fork this package and contribute by submitting a pull request to enhance its functionalities.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/gocanto/converter/blob/master/LICENSE.md) for more information.

How can I thank you?
--------------------

[](#how-can-i-thank-you)

Why not star the github repo and share the link for this repository on Twitter?

Don't forget to [follow me on twitter](https://twitter.com/gocanto)!

Thanks!

Gustavo Ocanto.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

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 ~0 days

Total

2

Last Release

2579d ago

Major Versions

0.0.1 → 1.0.02019-06-11

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5246059?v=4)[Gus](/maintainers/gocanto)[@gocanto](https://github.com/gocanto)

---

Top Contributors

[![gocanto](https://avatars.githubusercontent.com/u/5246059?v=4)](https://github.com/gocanto "gocanto (42 commits)")

---

Tags

agnosticconvertercurrenciesimmutablelibraryphpphpcurrencyconverter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gocanto-converter/health.svg)

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

PHPackages © 2026

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