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(6mo ago)3208—0%MITPHPPHP ^8.1CI passing

Since Dec 2Pushed 6mo 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 3w 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

36

—

LowBetter than 79% of packages

Maintenance66

Regular maintenance activity

Popularity17

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

204d 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://avatars.githubusercontent.com/u/21076418?v=4)[Андрей Гурковский](/maintainers/polopolaw)[@polopolaw](https://github.com/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

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.6k](/packages/larastan-larastan)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76518.2M120](/packages/laravel-mcp)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)

PHPackages © 2026

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