Releases: whitecube/php-prices
Releases · whitecube/php-prices
v4.0.0-beta.1
What's Changed
- Fix property not initialized error on jsonSerialize by @voidgraphics in #17
Full Changelog: v4.0.0-beta...v4.0.0-beta.1
v4.0.0-beta
What's Changed
- [4.x] Use RationalMoney when computing modifier totals by @voidgraphics in #16
Full Changelog: v3.1.1...v4.0.0-beta
Bug fixes
RationalMoney usage in serialized value
v3.1.0 Updated json serialization using RationalMoney
RationalMoney support
This new major version
- adds support for
\Brick\Money\RationalMoney
instances as the base value for price objects. - adds typehints everywhere
- removes support for PHP 7.4
The aim is to allow division and multiplication operations to be done without rounding errors. More information about rounding errors can be found here.
Warning
This contains breaking changes, tied to the changes in typehints in interfaces and classes you may implement/extend.
Namely, classes that implement the Whitecube\Price\PriceAmendable
interface, and classes that extend Whitecube\Price\Formatting\CustomFormatter
need to specify the correct, updated typehints. Consult these files and update your typehints appropriately.
PHP 8.1 support & new feature
New features:
- PHP 8.1 compatibility
toMinor
method to easily access minor amount
Bug fixes:
- Fixed parsing of values with narrow non-breaking spaces (a73bb01)
New feature update : formatUsing formatter classes
New feature update :
Price::formatUsing()
: Now accepts callable closures, custom formatter class names (string) and instances (as long as they extend\Whitecube\Price\Formatting\CustomFormatter
). Examples in the docs and tests.
New features: Money strings formatting
New features:
Price::format(Price|Vat|Money $value, string $locale)
: formats given monetary value into a human readable string respecting the target locale's formatting syntax.Price::formatUsing(callable $closure)
: add your own formatting functions!