PHPackages                             tautiz/cuex - 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. tautiz/cuex

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

tautiz/cuex
===========

Currency Exchange rates library for PHP

08PHP

Since Nov 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/tautiz/CuEx)[ Packagist](https://packagist.org/packages/tautiz/cuex)[ RSS](/packages/tautiz-cuex/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CuEx
====

[](#cuex)

> Currency Exchange rates library for PHP

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

[](#installation)

```
$ composer require tautiz/CuEx
```

Add service to App providers array:

```
CuEx\CuExServiceProvider::class,

```

Usage
-----

[](#usage)

Create an HTTP adapter

```
$httpAdapter = new \Ivory\HttpAdapter\FileGetContentsHttpAdapter();
```

Then, you can create a provider and add it to CuEx:

```
// Create the Yahoo Finance provider
$provider = new \CuEx\Provider\YahooFinanceProvider($httpAdapter);

// Create CuEx with the provider
$cuex = new \CuEx\CuEx($provider);
```

### Quoting

[](#quoting)

To retrieve the latest exchange rate for a currency pair, you need to use the `quote()` method.

```
$rate = $cuex->getRate('EUR/LTL');

// 3.4528
echo $rate;

// 3.4528
echo $rate->getValue();

// 15-11-28 23:59:59
echo $rate->getDate()->format('Y-m-d H:i:s');
```

> Currencies are expressed as their [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) code.

### Chaining providers

[](#chaining-providers)

It is possible to chain providers in order to use fallbacks in case the main providers don't support the currency or are unavailable. Simply create a `ChainProvider` wrapping the providers you want to chain.

```
$chainProvider = new \CuEx\Provider\ChainProvider([
    new \CuEx\Provider\YahooFinanceProvider($httpAdapter),
    new \CuEx\Provider\CurrencylayerProvider($httpAdapter,''),
    new \CuEx\Provider\FixerProvider($httpAdapter),
    new \CuEx\Provider\GoogleFinanceProvider($httpAdapter),
]);
```

The rates will be first fetched using the Yahoo Finance provider and will fallback to Google Finance.

### Caching

[](#caching)

For performance reasons you might want to cache the rates during a given time.

#### Doctrine Cache

[](#doctrine-cache)

##### Installation

[](#installation-1)

```
$ composer require doctrine/cache
```

##### Usage

[](#usage-1)

```
// Create the cache adapter
$cache = new \CuEx\Cache\DoctrineCache(new \Doctrine\Common\Cache\ApcCache(), 3600);

// Pass the cache to CuEx
$cuex = new \CuEx\CuEx($provider, $cache);
```

All rates will now be cached to 3600 minutes.

### Currency Codes

[](#currency-codes)

CuEx provides an enumeration of currency codes so you can use autocompletion to avoid typos.

```
use \CuEx\Util\CurrencyCodes;

// Retrieving the EUR/LTL rate
$rate = $cuex->quote(new \CuEx\Model\CurrencyPair(
    CurrencyCodes::ISO_EUR,
    CurrencyCodes::ISO_LTL
));
```

License
-------

[](#license)

[MIT](https://github.com/tautiz/cuex/blob/master/LICENSE)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/936a97c6ef589090d7e2e61b683b9c9b27ff8b2251292faa1ac0e79e4df57080?d=identicon)[tautiz](/maintainers/tautiz)

---

Top Contributors

[![tautiz](https://avatars.githubusercontent.com/u/807294?v=4)](https://github.com/tautiz "tautiz (1 commits)")

### Embed Badge

![Health badge](/badges/tautiz-cuex/health.svg)

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

###  Alternatives

[jcergolj/extra-checks-for-spatie-laravel-server-monitor

Additional custom checks for Spatie laravel-server-monitor package

545.8k](/packages/jcergolj-extra-checks-for-spatie-laravel-server-monitor)

PHPackages © 2026

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