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

ActiveLibrary

shipsaas/currency-fx
====================

A PHP Library handles Currency FX from multiple online FX services. Battery-included.

1.0.0(3y ago)297MITPHPPHP ^8.1|^8.2

Since Apr 17Pushed 3y agoCompare

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

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

PHP Currency FX Library
=======================

[](#php-currency-fx-library)

[![codecov](https://camo.githubusercontent.com/b8c5c7754d9ee879841fff115682c00f0acb4edcfcd363578cab5336567132b0/68747470733a2f2f636f6465636f762e696f2f67682f73686970736161732f63757272656e63792d66782f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d5331524139584b553934)](https://codecov.io/gh/shipsaas/currency-fx)[![Unit Test (PHP 8.1, 8.2)](https://github.com/shipsaas/currency-fx/actions/workflows/unit.yml/badge.svg)](https://github.com/shipsaas/currency-fx/actions/workflows/unit.yml)[![Integration Test](https://github.com/shipsaas/currency-fx/actions/workflows/integration.yml/badge.svg)](https://github.com/shipsaas/currency-fx/actions/workflows/integration.yml)[![E2E Test](https://github.com/shipsaas/currency-fx/actions/workflows/e2e.yml/badge.svg)](https://github.com/shipsaas/currency-fx/actions/workflows/e2e.yml)

A PHP Library handles Currency FX (rates &amp; conversions) with ease. Battery-included 🔋🔋🔋.

Available for Laravel too.

Tired of implementing these and integrate with 3rd services? Let's CurrencyFX help you to do that. Covered by Unit Testing &amp; battle-tested!

Available Services / Batteries
------------------------------

[](#available-services--batteries)

-
-
-
-
-

Supports
--------

[](#supports)

- PHP 8.1+

Dependencies
------------

[](#dependencies)

- Guzzle for API Requests
- [NeverThrow](https://github.com/shipsaas/never-throw) for straightforward OK/Error response.

Usage
-----

[](#usage)

Simply initialize the class with the required params. And it is ready to use in no time.

```
$service = new CurrencyCloudService($host, $loginId, $apiKey);
$rateResponse = $service->getRates('USD', 'SGD');

if (!$rateResponse->isOk()) {
    // failed to get the rate from third party service
    // do something here
}

$rate = $rateResponse->getOkResult()->rate; // float (1.4xxx)
```

Laravel Integration
-------------------

[](#laravel-integration)

Requirement: Laravel 10+

Just simply install the package and lets Laravel discovery magic happens 🥰

Since we already bind the services in Laravel Container, all you have to do is update the ENVs and that's all.

### Export the configuration

[](#export-the-configuration)

```
php artisan vendor:publish --tag=currency-fx-configs
```

### Update ENVs

[](#update-envs)

After published the config, checkout the `configs/currency-fx.php`.

We already defined some ENVs key for you to add 😜.

### Usage

[](#usage-1)

```
use CurrencyFX\Services\CurrencyLayerService;
use CurrencyFX\Services\ExchangerRatesApiIoService;

// global access
app(CurrencyLayerService::class)->getRates('USD', 'EUR');

// DI
class TransferService
{
    public function __construct(
        private ExchangerRatesApiIoService $rateService
    ) {
    }

    public function transfer(): TransferResult
    {
        $rateRes = $this->rateService->getRates('EUR', 'GBP');
        if ($rateRes->isError()) {
            return TransferResult::error(...);
        }

        $rate = $rateRes->getOkResult()->rate;
    }
}
```

Tests
-----

[](#tests)

We love tests, always. We have 3 kind of test cases:

- Unit Tests
- Integration Tests
- E2E Tests

Check out the [TEST-README.md](./tests/README.md) to learn more!

Contribute to the project
-------------------------

[](#contribute-to-the-project)

- All changes must follow PSR-1 / PSR-12 coding conventions.
- Unit testing is a must, cover things as much as you can.

Feel free to add more driver and share it to the whole PHP community 😆

This library is useful?
-----------------------

[](#this-library-is-useful)

Thank you, please give it a ⭐️⭐️⭐️ to support the project.

Don't forget to share with your friends &amp; colleagues, so they can also build their own SaaS products as well 🚀

License
-------

[](#license)

MIT LICENSE

Contributors
------------

[](#contributors)

ShipSaas, Seth Phat &amp; Contributors

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

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

Unknown

Total

1

Last Release

1123d ago

### Community

Maintainers

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

---

Top Contributors

[![sethsandaru](https://avatars.githubusercontent.com/u/23478115?v=4)](https://github.com/sethsandaru "sethsandaru (14 commits)")

---

Tags

currency-exchangecurrency-rateslaravellaravel-libraryphpphp-librarycurrencylibraryexchange ratesPHP Libraryfxfx\_rateslaravel-librarycurrency rates

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[florianv/swap

Exchange rates library for PHP

1.3k6.4M16](/packages/florianv-swap)[otherguy/php-currency-api

A PHP API Wrapper to offer a unified programming interface for popular Currency Rate APIs.

2526.2k](/packages/otherguy-php-currency-api)[florianv/laravel-swap

Currency exchange rates library for Laravel and Lumen

3342.0M2](/packages/florianv-laravel-swap)[florianv/exchanger

Currency exchange rates framework for PHP

1874.7M15](/packages/florianv-exchanger)[nutgram/nutgram

The Telegram bot library that doesn't drive you nuts

714214.9k8](/packages/nutgram-nutgram)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

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