---
title: "Multi-currency totals — Money for Laravel | Roundly"
description: "Hold balances in several currencies with MoneyBag and total them into one currency with a single exact rounding."
url: https://roundly-consulting.com/open-source/docs/money-for-laravel/money-bag
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Money for Laravel](https://roundly-consulting.com/open-source/docs/money-for-laravel.md)

# Multi-currency totals

MoneyBag is an immutable multi-currency accumulator — a wallet or basket that keeps balances in several currencies side by side:

```php
use RoundlyConsulting\Money\MoneyBag;

$bag = MoneyBag::of(Money::ofMajor('10', 'EUR'), Money::ofMajor('12', 'USD'))
    ->add(Money::ofMajor('100', 'CZK'))
    ->subtract(Money::ofMajor('2', 'USD'));

$bag->get('USD');         // 10.00 USD
$bag->get('GBP');         // 0.00 GBP — zero when absent
$bag->currencies();       // [CZK, EUR, USD] — sorted by code
$bag->all();              // list<Money>
$bag->isEmpty();          // false

$bag->total('EUR');                    // converted and summed exactly, rounded once
$bag->total('EUR', now()->subDay());   // with historical rates
```

- of() and add() group amounts by currency code; subtract() works the same way.
- get() returns zero for a currency the bag doesn’t hold.
- currencies() and all() are sorted by code.
- isEmpty() — balances that return to zero drop out of the bag.
- A currency with the same code but a different exponent throws CurrencyMismatch.

## Totals without drift

total($in, ?$on, ?$rounding) converts every balance through the bound exchange provider and sums them as one exact rational, rounding once at the end (HalfEven by default) — no per-currency rounding drift. Pass a date to use historical rates.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/money-for-laravel.md)
