Download the PHP package leaphly/price without Composer
On this page you can find all versions of the php package leaphly/price. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package price
Price
A Price is the amount of a product in different currencies.
in PHP is:
Why?!
- Because is not recommended to work with the float for the money in PHP...
- Because is better to implement money as value objects.
- Because in the e-commerce domain a product has always* a different price for different currencies.
- Because we needed :).
Goodies:
- It helps you to work with money.
- It helps you to work with currencies.
- It helps you to work with multiple currencies, converted or explicit.
- It is shipped with some math operations:
addition
,multiplication
,division
,subtraction
... - This library extends the mathiasverraes/money.
- Immutable Value Object.
- Shipped with an example of
DoctrineType
Simple usage
- The T-Shirt costs 10€ and 8£
Constructor
Usage with explicit currency values.
Usage with mixed explicit and converted values
Do we use the same language?
- An espresso coffee costs [2€ or 2.3$] here and [1€ or 1.2$] take away.
espresso
is a product.
here
and take away
are contexts (still is a missing feature).
2€
2.3$
is a Price with 2 currencies,
1€
1.2$
is a Price with 2 currencies,
2€ or 2.3$ here, and 1€ or 1.2$ for take away.
is a PriceList (still is a missing feature).
API (still not stable)
Price
Example sum two prices
With the \Iterator interface
Implement the \Iterator
so Price is an array of Money.
Use it with the Money Value Object
Note: the iteration is valid only on the explicit currencies not on the converted one.
License 
This library is under the MIT license. See the complete license in the repository:
Resources/meta/LICENSE
Test
About
See also the list of contributors.
Reporting an issue or a feature request
Issues and feature requests are tracked in the Github issue tracker.
Note: this library uses the dev
version of the Mathias Verraes Money.