Download the PHP package voskobovich/yii2-price-formatter without Composer
On this page you can find all versions of the php package voskobovich/yii2-price-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download voskobovich/yii2-price-formatter
More information about voskobovich/yii2-price-formatter
Files in voskobovich/yii2-price-formatter
Package yii2-price-formatter
Short Description Component for converting price for Yii2
License MIT
Homepage https://github.com/voskobovich/yii2-price-formatter
Informations about the package yii2-price-formatter
Yii2 Price Formatter
This component converts currency values (prices) between fixed-point representation (int as number of cents) and floating point representation (float as dollars and cents).
Support
See example
The example of the USD.
Converts 3.99 dollars => 399 cents
Converts 3 dollars 99 cents => 399 cents
Converts 399 cents => 3.99 dollars
Converts 399 cents => 3 dollars, 99 cents
Converts 399 cents => $3.99 (with currency symbol )
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Configuration component in your app config file
[
...
'components' => [
'priceFormatter' => [
'class' => 'voskobovich\price\components\PriceFormatter',
// 'currencyCode' => 'USD',
'currencyCode' => function($component) {
return Yii::$app->user->identity->currency_code;
}
]
]
]
``