Download the PHP package grahamsutton/moneyman without Composer
On this page you can find all versions of the php package grahamsutton/moneyman. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grahamsutton/moneyman
More information about grahamsutton/moneyman
Files in grahamsutton/moneyman
Package moneyman
Short Description MoneyMan is a way to represent money in your application as an object.
License
Informations about the package moneyman
MoneyMan
MoneyMan is a way to represent money in your application as an object.
Using floating point numbers can be bad news and lead to a lot of headaches that may make you afraid to want to perform currency exchanges in your application. MoneyMan strives to make dealing with money easy by using the following:
- Immutable money objects that protect you from having money values suddenly become something else.
- Integer-based money values that protect your app against rounding errors.
- Currency exchange to convert money objects into a desired currency
- Interchangeable currency exchange services using either Google, Yahoo, or Fixer (backed by the Swap library)
- Formatting the display of your money object values to be shown in a desired locale
- Ability to two money objects of different currencies and get an output in desired currency
Currently supported exchange rate servcies include:
Install
Use the command line:
Quick Example
Create money object and print its value based on locale
Get a Swap object for fetching rates
Exchange a Money object from one currency to another
Doing Arithmetic
Add two Money objects with same currency
Subtract two Money objects with same currency
Add two Money objects with different currencies
Subtract two Money objects with different currencies
Why Immutable Money Objects?
It may not seem to make a whole bunch of sense at first, but when you really think a little deeper, it does. Imagine you have a $20 USD bill. Can a $20 bill suddenly become $35? Obviously, no. You must add $15 to it to get a new single value, you do not change the value of the $20 bill.
Money objects in MoneyMan intend to take a more "natural" world approach. In the example, the $20 bill represents a single value of money (the first Money object). When we add $15 to it, we are adding a second, separate value of money (the second Money object). From this we get a new, single value of both totals combined (a new, third Money object).
MIT License
The MIT License
Copyright (c) 2017 Graham Sutton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of moneyman with dependencies
florianv/swap Version ^3.0
php-http/message Version ^1.5
php-http/guzzle6-adapter Version ^1.1