Download the PHP package lukaszwit/currency without Composer
On this page you can find all versions of the php package lukaszwit/currency. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lukaszwit/currency
More information about lukaszwit/currency
Files in lukaszwit/currency
Package currency
Short Description Currency handling with float operations safe
License MIT
Informations about the package currency
Currency
Currency package introduces strictly typed and precision safe containers to work with currencies. Currency keeps internally amount as string (the only safe representation of floating point number in PHP). It ensures that once any amount in given currency is defined you cannot change it's type and you can type hint your methods to use nay currency or one exact currency. Internally this lib uses SplType extension and SplString class. Keeping amounts in string prevents from floats problems and lets you use high precision libraries like bcMath to process arithmetic operations.
See how floats work in PHP - http://php.net/manual/en/language.types.float.php
See what happen when you relies on float precision - http://stackoverflow.com/questions/3726721/php-math-precision
This package also supports well-known cryptocurrencies listed in wikipedia - http://en.wikipedia.org/wiki/Cryptocurrency#List_of_cryptocurrencies
Install
First you need to install SPL_Types - PECL extension:
If SPL_Types is installed you can now install currency package via Composer:
Usage
Type hinting
see more examples in examples directory - https://github.com/lukaszwit/currency/tree/master/examples.
Testing
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.