PHPackages                             viewflex/forex - 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. viewflex/forex

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

viewflex/forex
==============

Providing live currency exchange rates in Laravel and Lumen, with configurable provider and caching.

0.2.1(7y ago)14.0k↓50%2[2 PRs](https://github.com/viewflex/forex/pulls)MITPHP

Since Mar 7Pushed 5y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (6)Used By (0)

Forex
=====

[](#forex)

[![GitHub license](https://camo.githubusercontent.com/ee061e6c1798bd95fa104c910010a3119850b186c323a1c848b3abcb029dc764/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e7376673f6d61784167653d32353932303030)](LICENSE.md)

Providing live currency exchange rates in Laravel and Lumen, with configurable provider and caching.

Overview
--------

[](#overview)

For live currency exchange rates, your choice of provider depends on various factors, including pricing, features, and reliability, which sometimes change. The purpose of this package is to provide a fixed exchange rate endpoint for your application, which can be configured to use one of the various popular providers, and re-configured at any time to use a different provider if necessary.

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

[](#installation)

Via Composer:

```
$ composer require viewflex/forex
```

Configuration
-------------

[](#configuration)

Configuration values must be specified in the application's `.env` file, or in your environment's `$_ENV` or `$_SERVER` arrays - all of these options are supported transparently. Below are sample configurations for the currently supported providers. You can also customize the cache refresh interval as described below.

### Supported Providers

[](#supported-providers)

#### Currency Converter API (free)

[](#currency-converter-api-free)

```
FOREX_PROVIDER=CurrencyConverterApiFree
FOREX_PROVIDER_URL=http://free.currencyconverterapi.com/api/v6/convert

```

#### Currency Converter API (paid)

[](#currency-converter-api-paid)

```
FOREX_PROVIDER=CurrencyConverterApi
FOREX_PROVIDER_URL=https://api.currencyconverterapi.com/api/v6/convert
FOREX_PROVIDER_KEY=

```

#### Fixer (free and paid)

[](#fixer-free-and-paid)

```
FOREX_PROVIDER=Fixer
FOREX_PROVIDER_URL=https://data.fixer.io/api/latest
FOREX_PROVIDER_KEY=

```

\**The free subscription supports only EUR as the base currency.*

#### Open Exchange Rates (free and paid)

[](#open-exchange-rates-free-and-paid)

```
FOREX_PROVIDER=OpenExchangeRates
FOREX_PROVIDER_URL=https://openexchangerates.org/api/latest.json
FOREX_PROVIDER_KEY=

```

\**The free subscription supports only USD as the base currency.*

### Caching

[](#caching)

Use the `FOREX_CACHE_MINUTES` environment variable to specify how long a rate is cached. Unless specified, the default of 720 (12 hours) is used. Setting this variable to 0 disables caching of rates. Using a longer cache refresh interval can help you to avoid interruption of service (or extra charges if using a paid service).

Usage
-----

[](#usage)

```
$server = new \Viewflex\Forex\Forex();
echo $server->getRate('USD', 'CAD');
```

Tests
-----

[](#tests)

Tests can be run as described in the [test documentation](./tests/README.md).

License
-------

[](#license)

This software is offered for use under the [MIT License](LICENSE.md).

Changelog
---------

[](#changelog)

Release versions are tracked in the [Changelog](CHANGELOG.md).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

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

Total

4

Last Release

2709d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b93f8b0a642b06fab7cd680ba7a56539f9b77e5c09fae9f26bfcc319128d794?d=identicon)[viewflex](/maintainers/viewflex)

---

Top Contributors

[![viewflex](https://avatars.githubusercontent.com/u/6198916?v=4)](https://github.com/viewflex "viewflex (6 commits)")

---

Tags

moneycurrencyconversionexchange rateforex

### Embed Badge

![Health badge](/badges/viewflex-forex/health.svg)

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

###  Alternatives

[florianv/swap

Exchange rates library for PHP

1.3k6.4M16](/packages/florianv-swap)[brick/money

Money and currency library

1.9k37.9M102](/packages/brick-money)[florianv/laravel-swap

Currency exchange rates library for Laravel and Lumen

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

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.

4081.1M6](/packages/torann-currency)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[kwn/number-to-words

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

4235.0M21](/packages/kwn-number-to-words)

PHPackages © 2026

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