moneyphp / money

PHP implementation of Fowler's Money pattern.
http://moneyphp.org
MIT License
4.63k stars 441 forks source link

Serialization of Money class #616

Closed Ferikl closed 3 years ago

Ferikl commented 4 years ago

Hi guys! thanks so much for great package! I am using it a lot and found small inconvenience: JSON serialization create next object:

{
    "amount": "4000",
    "currency": "USD"
}

as you can see "amount" field is a string

Can you please change serialization strategy to make "amount" integer? Thanks!

frederikbosch commented 3 years ago

This is because we support integers greater than PHP's maximum integer. In order to be able to do that, it must be denoted as a string.