mgamadeus/ddd-common-money

Currency and MoneyAmount value objects for mgamadeus/ddd

Maintainers

Package info

github.com/mgamadeus/ddd-money

pkg:composer/mgamadeus/ddd-common-money

Statistics

Installs: 17

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-04-14 23:29 UTC

This package is auto-updated.

Last update: 2026-04-14 23:30:22 UTC


README

Currency and MoneyAmount value objects for the mgamadeus/ddd framework.

Installation

composer require mgamadeus/ddd-common-money

What it does

Provides lightweight value objects for monetary amounts and currencies:

  • MoneyAmount — amount + currency code (e.g. new MoneyAmount(9.99, 'USD'))
  • Currency — ISO 4217 currency with symbol, placement, and validation for 27+ supported currencies (EUR, USD, GBP, CHF, etc.)

Usage

use DDD\Domain\Common\Entities\Money\MoneyAmount;
use DDD\Domain\Common\Entities\Money\Currency;

$price = new MoneyAmount(29.99, 'EUR');
$currency = new Currency('USD');

Overriding

Extend in your project to add currencies or customize behavior:

namespace App\Domain\Common\Entities\Money;

use DDD\Domain\Common\Entities\Money\Currency as BaseCurrency;

class Currency extends BaseCurrency
{
    // Add project-specific currencies
}