Money
Money class for your applications
Last updated
Money class for your applications
Last updated
Handling Money with PHP is not so fun and game, is it?
To build a great app, you have to have a great abstraction ahead for the Money type, especially if your apps are going to work closely with the money, eg:
Finance
E-commerce
Logistic
...
Worry not, ShipSaaS got your back with the Money
class, features:
Immutable by default, money is pretty important, ya know.
Super lightweight yet strong helper
Money
class use int
and stores your money as cents. So:
$6 => 600
$5.99 => 599
...
In this way, we will never get the "floating-point" issues (for all langs & DB engines)
Never use float
for Money (for all langs).
Learn more at:
There are some built-in methods that would help you to do the math:
You also can get the human-readable text to show up to your users.
It will generate the text based on the currencies
configuration.