diff --git a/README.md b/README.md index 7a76b0c..f192ed8 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,12 @@ $money->value(); // 4500 $money = money(1500); // $15.00; default currency $money = money(1500, 'EUR'); // 15.00 € $money = money(2000, new USD); // $20.00 -$money = money(3000, CZK::class); // 20 Kč +$money = money(3000, CZK::class); // 30 Kč // Using decimals $money = Money::fromDecimal(15.00, 'EUR'); // 15.00 € $money = Money::fromDecimal(20.00, new USD); // $20.00 -$money = Money::fromDecimal(30.00, CZK::class); // 20 Kč +$money = Money::fromDecimal(30.00, CZK::class); // 30 Kč ``` ### Arithmetics @@ -112,16 +112,16 @@ money(100, USD::class)->equals(money(200, CZK::class)); // Assuming CZK is 25:1 USD // ✅ true -money(100, USD::class)->equals(money(100, USD::class)); +money(100, USD::class)->is(money(100, USD::class)); // ❌ false: different monetary value -money(100, USD::class)->equals(money(200, USD::class)); +money(100, USD::class)->is(money(200, USD::class)); // ❌ false: different currency -money(100, USD::class)->equals(money(2500, CZK::class)); +money(100, USD::class)->is(money(2500, CZK::class)); // ❌ false: different currency AND monetary value -money(100, USD::class)->equals(money(200, CZK::class)); +money(100, USD::class)->is(money(200, CZK::class)); ``` ### Adding fees @@ -221,6 +221,8 @@ To work with the registered currencies, use the bound `CurrencyManager` instance ### Creating a currency +This package provides only USD currency by default. + You can create a currency using one of the multiple supported syntaxes. ```php // anonymous Currency object @@ -412,7 +414,7 @@ For the Czech Crown (CZK), the display decimals will be `0`, but the math decima For the inverse of what was just explained above, you can use the `rawFormatted()` method. This returns the formatted value, **but uses the math decimals for the display decimals**. Meaning, the value in the example above will be displayed including cents: ```php -money(123456, new CZK)->formatted(); // 1 235,56 Kč +money(123456, new CZK)->rawFormatted(); // 1 235,56 Kč ``` This is mostly useful for currencies like the Czech Crown which generally don't use cents, but **can** use them in specific cases. diff --git a/composer.json b/composer.json index c395968..dc9bc69 100644 --- a/composer.json +++ b/composer.json @@ -43,5 +43,10 @@ } }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "config": { + "allow-plugins": { + "pestphp/pest-plugin": true + } + } } diff --git a/tests/Pest/FormattingTest.php b/tests/Pest/FormattingTest.php index dfc1f08..fda4e03 100644 --- a/tests/Pest/FormattingTest.php +++ b/tests/Pest/FormattingTest.php @@ -1,6 +1,5 @@