All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
4.0.3 - 2021-12-01
jsonSerialize
return types, resulting in no PHP 8.1 warnings.- Documentation CI pipeline failure.
4.0.2 - 2021-06-30
- Added all extensions to
composer.json
, including those bundled with PHP.
- Remove all
empty
uses. Money values of '0' gave an assertion error in decimal formats (#655)
4.0.1 - 2021-05-25
- Allow
int
as multiplier forMoney::multiply
- Allow
int
as divisor forMoney::divide
4.0.0 - 2021-05-17
- PHP8.0 compatibility (#633 and #619)
- Recommendation to use a type-checker like psalm or phpstan
- Rounding to units
Converter#convertAndReturnWithCurrencyPair
to get the combination of the converted money and currency pairConverter#convertAgainstCurrencyPair
to convert against a currency pair
- [BC break] BC Math required as it is the default calculator
- [BC break] The methods
multiply
anddivide
do not accept floating points any more. Callers are required to convert a float to string (e.g.sprintf('%.14F', $float)
) before calling these methods. - Allow multiple arguments to
Money#isSameCurrency
- Renamed second parameter of
Parser#parse
to$fallbackCurrency
- Fix GMP multiply and divide by negative (#640 #626)
- Currency code must be uppercase (#639 #638 #637)
- The CPU no longer overheats when using this library (#634)
- No longer allowing null amount (#615)
- Update cached currencies (#583)
- Only numeric strings allowed (#575)
- Calculator and Number are internal (#465)
- Negative ratio in
Money#allocate()
is now allowed (#258)
- [BC break] Removed PhpCalculator
- [BC break] Removed
Currency#isAvailableWithin()
- [BC break] Removed string as allowed parameter for
MoneyParser#parse
- [BC break] Completely remove float usage, methods now return numeric-strings
3.3.1 - 2019-03-13
- GMP: division of negative values
- GMP: compare 0.x value
3.3.0 - 2019-12-27
- Added types for
Money
to be understood as pure/immutable downstream (#576)
- JSON serialization (#551)
- Several documentation fixes
- Minor fixes
3.2.1 - 2019-02-07
Money::allocate
now maintains keys of ratios array- All parsers now emit a deprecation warning when passing currency as string
- Docs fix : plus sign in numeric strings is allowed
- Added ext-json as required extension
- Throw exception in case of empty currency
- BCMath calculator now uses scale parameters for addition and subtracting
- Fixed allocation remainder bug
- Added PHP 7.3 in test suite
- Fixed dockerignore to ignore Dockerfile
- Fixed Bitcoin parsing bug when using trailing zeros
3.2.0 - 2018-12-05
- Exchanger exchange
- Generated static factory to help IDEs understand code like
Money::EUR(500)
- Aggregation functions (min, max, avg, sum)
Money::add
andMoney::subtract
now accept variadic arguments
- Division causing unnecessary fractional parts
- Numeric comparison for negative numbers
3.1.3 - 2018-02-16
- Allocation when the amount is smaller than the number of ratios
3.1.2 - 2018-02-16
Number::fromNumber
to be used when the actual type is not known
- Refactored
Number
usage to make the code cleaner and use less casting
- Float cast to string issue on certain locales
3.1.1 - 2018-01-19
- Float cast to string issue on certain locales
- Deal with numbers represented with E-XX
3.1.0 - 2018-01-10
- CurrencyList to instantiate in-memory currencies
- modulus method to Money
- ratioOf method to Money
- Comparator for easier testing Money object with PHPUnit
- IntlLocalizedDecimalParser and IntlLocalizedDecimalFormatter
MoneyParser::parse
method now expects a Currency object- Dropped PHP 5.5
- Passing currency code as string to
MoneyParser::parse
- Do not allocate remainder to a ratio of zero
- Conversion result is always 0 when subunit difference is large enough
- Unexpected result when converting small Bitcoin amounts
- Fixed StyleCI being too aggressive
3.0.9 - 2017-11-05
- Bitcoin currency symbol
3.0.8 - 2017-10-03
- Rounding issue in Number class.
- Reduce composer package file size by leaving out docs and logo.
- Missing Travis tests for PHP 7.2.
3.0.7 - 2017-08-07
- Currencies
3.0.6 - 2017-07-25
- IndirectExchange: a way to get an exchange rate through a minimal set of intermediate conversions.
- Tests for HHVM
- Incorrect documentation on Bitcoin parser
3.0.5 - 2017-04-26
- numericCodeFor method to ISOCurrencies
3.0.4 - 2017-04-21
- Negative method
- Updated ISO Currencies
- Removed old Belarusian ruble from ISOCurrencies (BYR)
- ISOCurrencies will no longer have a blank currency
- Double symbol when formatting negative Bitcoin amounts
3.0.3 - 2017-03-22
- Parsing empty strings and number starting or ending with a decimal point for DecimalMoneyParser
- Parsing zero for DecimalMoneyParser
- Multiplying and dividing with a locale that use commas as separator
3.0.2 - 2017-03-11
- BCMath / GMP: comparing values smaller than one
- GMP: multiplying with zero
- ISOCurrencies: minor refactoring, remove duplication of code
3.0.1 - 2017-02-14
- Reversed Currencies Exchange to try resolving reverse of a currency pair
- Documentation on allowed integer(ish) values when constructing Money
- Passing integer validation when chunk started with a dash
- Passing integer validation when the fractional part started with a dash
- Formatting problem for Bitcoin currency with small amounts in PHP < 7.0
- Money constructed from a string with fractional zeroes equals to a Money constructed without the fractional part (eg.
'5.00'
and'5'
)
3.0.0 - 2016-10-26
- DecimalMoneyFormatter: returns locale-independent raw decimal string
- [BC break] Replaced StringToUnitsParser with DecimalMoneyParser
- [BC break] Moved
Money\Exception\Exception
toMoney\Exception
- [BC break] UnkownCurrencyException is now DomainException instead of RuntimeException
- [Doctrine break] In
Currency
the private variablename
was renamed tocode
, which could break your Doctrine mapping if you are using embeddables or any other Reflection related implementation.
- FixedExchange: returns fixed exchange rates based on a list (array)
- [BC break] Convert method now moved to its own class: Converter
- [BC break] Exchange had one method getCurrencyPair which is now renamed to quote
- Minor documentation issues
- Integer detection when the number overflows the integer type and contains zeros
- Rounding numbers containg trailing zeros
- Converting Money to currency with different number of subunits
- PHP Spec tests
- absolute method to Money and Calculator
- subunitFor method to Currencies
- Currencies now extends IteratorAggregate
- Library exceptions now implement a common interface
- Formatter and Parser implementation are now rounding half up
- [BC break] Dropped PHP 5.4 support
- [BC break] Intl and Bitcoin formatters and parsers now require Currencies
- ISOCurrencies now uses moneyphp/iso-currencies as currency data source
- Documentation to be inline with upcoming version 3
- Rounding issues in calculators with negative numbers
- Formatting and parser issues for amounts and numbers with a trailing zero
- Improved many exception messages
- Registration of own Calculator implementations
3.0.0-beta - 2016-03-01
- Bitcoin parser and formatter
- Also checking tests folder for StyleCI
- Currencies are now included in the repo
- Currency list generation moved to dev dependency: reduces repo size
- BC Math calculator adding and subtracting failed when bcscale was set
- Parsing zero for StringToUnitsParser
- Currency repositories (ISO currencies included)
- Money exchange (including Swap implementation)
- Money formatting (including intl formatter)
- Money parsing (including intl parser)
- Big integer support utilizing different, transparent calculation logic upon availability (bcmath, gmp, plain php)
- Money and Currency implements JsonSerializable
- Rounding up and down
- Allocation to N targets
- [BC break] Money::getAmount() returns a string instead of an int value
- [BC break] Moved stringToUnits to StringToUnitsParser parser
- Library requires at least PHP 5.4
- Library uses PSR-4
- Integer overflow
- [BC break] UnkownCurrency exception
- [BC break] Currency list is now provided by umpirsky/currency-list
- [BC break] RoundingMode class
- [BC break] Announced deprecations are removed (Currency::getName, CurrencyPair::getRatio, Money::getUnits)
- 2015-03-23 Minimum php version is now 5.4
- 2015-03-23 JsonSerializable
- (... missing changelog because who remembers to document stuff anyway?)
- 2014-03-22 Removed \Money\InvalidArgumentException in favour of plain old InvalidArgumentException
- 2014-03-22 Introduce RoundingMode object, used to specify desired rounding
- 2014-03-22 Introduced RoundingMode backwards compatible API changes to Money::multiply and Money::divide
- 2014-03-22 Allow RoundingMode to be specified when converting currencies
- 2014-03-22 CurrencyPair has an equals() method
- 2013-10-13 Base currency and counter currency in CurrencyPair named correctly.
- 2013-01-08 Removed the Doctrine2\MoneyType helper, to be replaced by something better in the future. It's available at https://gist.github.com/4485025 in case you need it.
- 2013-01-08 Use vendor/autoload.php instead of lib/bootstrap.php (or use PSR-0 autolaoding)
- 2012-12-10 Renamed Money::getUnits() to Money::getAmount()