PHPackages                             svk-digital/laravel-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. svk-digital/laravel-currency

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

svk-digital/laravel-currency
============================

Extensible Laravel package for working with fiat and crypto currency exchange rates.

2.0.0(5mo ago)290—0%MITPHPPHP ^8.1CI passing

Since Dec 2Pushed 5mo agoCompare

[ Source](https://github.com/internet-design-studio/laravel-currency)[ Packagist](https://packagist.org/packages/svk-digital/laravel-currency)[ RSS](/packages/svk-digital-laravel-currency/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (3)Used By (0)

Laravel Currency Package
========================

[](#laravel-currency-package)

`svk-digital/laravel-currency` is an extensible Laravel package for working with fiat and crypto currency exchange rates. Out of the box it ships with adapters for the Central Bank of Russia DailyInfo web-service, CurrencyFreaks API, and ExchangeRateHost API, but you can plug in any provider via configuration or custom adapters.

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel 9.x, 10.x, 11.x or 12.x

Quick Start
-----------

[](#quick-start)

```
use DateTimeImmutable;
use SvkDigital\Currency\Contracts\CurrencyServiceContract;
use SvkDigital\Currency\Facades\Currency;
use SvkDigital\Currency\ValueObjects\FiatCurrency;

final class RatesController
{
    public function __construct(private CurrencyServiceContract $currencyService) {}

    public function __invoke()
    {
        $date = new DateTimeImmutable('2024-11-30');

        // Via dependency injection
        $rate = $this->currencyService
            ->rate()
            ->base(new FiatCurrency('RUB'))
            ->quote(new FiatCurrency('USD'))
            ->date($date)
            ->get();

        // Or via facade
        $rate = Currency::rate()
            ->base(new FiatCurrency('RUB'))
            ->quote(new FiatCurrency('USD'))
            ->date($date)
            ->get();
    }
}
```

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

[](#installation)

```
composer require svk-digital/laravel-currency
```

The service provider and facade are auto-discovered by Laravel. Publish the configuration:

```
php artisan vendor:publish --tag=currency-config
```

For advanced usage, you can also publish and customize the service provider:

```
php artisan vendor:publish --tag=currency-provider
```

Documentation
-------------

[](#documentation)

Full documentation is available in the [`docs/`](docs/) directory:

- **[Getting Started](docs/index.md)** - Installation and basic usage
- **[Configuration](docs/configuration.md)** - Package configuration options
- **[Built-in Adapters](docs/adapters.md)** - Available adapters (CBR, CurrencyFreaks, ExchangeRateHost)
- **[Testing](docs/testing.md)** - Test your code with fake exchange rates
- **[Custom Adapters](docs/custom-adapters.md)** - Create your own adapter and override provider selection

Features
--------

[](#features)

- ✅ Multiple built-in adapters (CBR, CurrencyFreaks, ExchangeRateHost)
- ✅ Support for fiat currencies via ISO-4217 value objects
- ✅ Crypto currency support (via custom adapters)
- ✅ Automatic caching with configurable TTL
- ✅ Custom adapter support
- ✅ Dynamic provider selection
- ✅ Comprehensive error handling
- ✅ Multiple quote currencies in a single request

Built-in Adapters
-----------------

[](#built-in-adapters)

### CBR Adapter

[](#cbr-adapter)

- Central Bank of Russia SOAP service
- RUB base currency only
- Historical rates support

### CurrencyFreaks Adapter

[](#currencyfreaks-adapter)

- REST API integration
- Any base currency support
- API key required

### ExchangeRateHost Adapter

[](#exchangeratehost-adapter)

- REST API integration
- Any base currency support
- Optional access key

See [Built-in Adapters](docs/adapters.md) for detailed information.

Custom Adapters
---------------

[](#custom-adapters)

You can create custom adapters to integrate with any currency provider. The package also allows you to override the service provider to implement dynamic provider selection logic without modifying configuration files.

See [Custom Adapters Guide](docs/custom-adapters.md) for complete instructions.

Testing
-------

[](#testing)

The package provides a `fake()` method on the `Currency` facade that allows you to mock exchange rates in your tests without making real API calls, similar to Laravel's `Http::fake()`.

```
use DateTimeImmutable;
use SvkDigital\Currency\Facades\Currency;
use SvkDigital\Currency\ValueObjects\FiatCurrency;

// In your test setup
Currency::fake()
    ->setRateValue(
        new FiatCurrency('RUB'),
        new FiatCurrency('USD'),
        new DateTimeImmutable('2024-01-01'),
        90.5
    );

// Now your code will use the fake adapter
$rate = Currency::rate()
    ->base(new FiatCurrency('RUB'))
    ->quote(new FiatCurrency('USD'))
    ->date(new DateTimeImmutable('2024-01-01'))
    ->get();
```

License
-------

[](#license)

MIT © Internet Design Studio.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance72

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Total

2

Last Release

159d ago

Major Versions

v1.0.0 → 2.0.02025-12-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/a18579e39381140c0a2a3cf69d13e2d425118f53fca8e7d1040d3cbdab4eccea?d=identicon)[svk-digital](/maintainers/svk-digital)

![](https://www.gravatar.com/avatar/7d49dc819943b1f1afdfb906ea68faf5b32d6a008d2385a41f5c752b1ed26cd0?d=identicon)[polopolaw](/maintainers/polopolaw)

---

Top Contributors

[![polopolaw](https://avatars.githubusercontent.com/u/21076418?v=4)](https://github.com/polopolaw "polopolaw (9 commits)")

---

Tags

laravelcurrencyxmlcryptosoapexchange ratescbr

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/svk-digital-laravel-currency/health.svg)

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

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[bmatovu/laravel-xml

Laravel XML Support

91270.4k](/packages/bmatovu-laravel-xml)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

36412.6k6](/packages/ultrono-laravel-sitemap)[tucker-eric/laravel-xml-middleware

A Laravel Middleware to accept XML requests

181.2M](/packages/tucker-eric-laravel-xml-middleware)

PHPackages © 2026

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