PHPackages                             voskobovich/yii2-price-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. voskobovich/yii2-price-formatter

ActiveYii2-widget

voskobovich/yii2-price-formatter
================================

Component for converting price for Yii2

1.1.2(10y ago)5103MITPHPPHP &gt;=5.4.0

Since Jan 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/voskobovich/yii2-price-formatter)[ Packagist](https://packagist.org/packages/voskobovich/yii2-price-formatter)[ Docs](https://github.com/voskobovich/yii2-price-formatter)[ RSS](/packages/voskobovich-yii2-price-formatter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

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).

[![License](https://camo.githubusercontent.com/e30da01bcb87b85405afac4d3282da23774b8708bf42331dde4105d3c68cb88d/68747470733a2f2f706f7365722e707567782e6f72672f766f736b6f626f766963682f796969322d70726963652d666f726d61747465722f6c6963656e73652e737667)](https://packagist.org/packages/voskobovich/yii2-price-formatter)[![Latest Stable Version](https://camo.githubusercontent.com/fb9a48c5d3c2d5ce2666e104e95dbdf1e6b7a5e45a5a9d12a53ffba8724b6be7/68747470733a2f2f706f7365722e707567782e6f72672f766f736b6f626f766963682f796969322d70726963652d666f726d61747465722f762f737461626c652e737667)](https://packagist.org/packages/voskobovich/yii2-price-formatter)[![Latest Unstable Version](https://camo.githubusercontent.com/bac22f7be8f05f2f3182ef5d5488c08ad3967c909d5efebb2db04e8ba1221f1c/68747470733a2f2f706f7365722e707567782e6f72672f766f736b6f626f766963682f796969322d70726963652d666f726d61747465722f762f756e737461626c652e737667)](https://packagist.org/packages/voskobovich/yii2-price-formatter)[![Total Downloads](https://camo.githubusercontent.com/5e4a953a279b1d3c9c6bdf8ff3f57d0a5a38ee25f1e97214bdfc963cdc9eecb0/68747470733a2f2f706f7365722e707567782e6f72672f766f736b6f626f766963682f796969322d70726963652d666f726d61747465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/voskobovich/yii2-price-formatter)

Support
-------

[](#support)

[GutHub issues](https://github.com/voskobovich/yii2-price-formatter/issues).

See example
-----------

[](#see-example)

The example of the USD.

Converts 3.99 dollars =&gt; 399 cents

```
Yii::$app->get('priceFormatter')->toStore(3.99); // input float
Yii::$app->get('priceFormatter')->toStore('3,99'); // input string
// Result: 399

```

Converts 3 dollars 99 cents =&gt; 399 cents

```
Yii::$app->get('priceFormatter')->toStoreByParts(3, 99);
// Result: 399

```

Converts 399 cents =&gt; 3.99 dollars

```
Yii::$app->get('priceFormatter')->toEdit(399);
// Result: 3.99

```

Converts 399 cents =&gt; 3 dollars, 99 cents

```
Yii::$app->get('priceFormatter')->toEditByParts(399);
// Result array:
[
    0 => 3,
    1 => 99
]

```

Converts 399 cents =&gt; $3.99 (with currency symbol )

```
Yii::$app->get('priceFormatter')->toView(399);
// Result: $3,99

```

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist voskobovich/yii2-price-formatter "~1.0"

```

or add

```
"voskobovich/yii2-price-formatter": "~1.0"

```

to the require section of your `composer.json` file.

Usage
-----

[](#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;
            }
        ]
    ]
]
``

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~33 days

Total

4

Last Release

3654d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4267178fdbc890dad02ce0e600f7f5b9bbb54f5824b90feb76724af8cebb710f?d=identicon)[voskobovich](/maintainers/voskobovich)

---

Tags

formattercurrencyyii2componentprice

### Embed Badge

![Health badge](/badges/voskobovich-yii2-price-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/voskobovich-yii2-price-formatter/health.svg)](https://phpackages.com/packages/voskobovich-yii2-price-formatter)
```

###  Alternatives

[nterms/yii2-mailqueue

Email queue component for yii2 that works with yii2-swiftmailer.

87129.2k2](/packages/nterms-yii2-mailqueue)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.7k](/packages/umanskyi31-opengraph)[dlds/yii2-mlm

Yii2 Multi Level Marketing component

183.8k](/packages/dlds-yii2-mlm)[tigrov/yii2-country

Country data for Yii2 using Intl extension and more.

151.1k](/packages/tigrov-yii2-country)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
