PHPackages                             kartik-v/yii2-money - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kartik-v/yii2-money

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

kartik-v/yii2-money
===================

An advanced money mask input for Yii 2.0 based on jquery maskmoney plugin styled for Bootstrap 3.

v1.2.3(7y ago)29915.4k↓16.9%2210BSD-3-ClauseJavaScript

Since Oct 5Pushed 6y ago4 watchersCompare

[ Source](https://github.com/kartik-v/yii2-money)[ Packagist](https://packagist.org/packages/kartik-v/yii2-money)[ Docs](https://github.com/kartik-v/yii2-money)[ RSS](/packages/kartik-v-yii2-money/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (10)Used By (10)

 [ ![Krajee Logo](https://camo.githubusercontent.com/4addfbb3869c3fc7d79befea4f06d9cf3655a686fb503df0da1d725859cfdef9/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f6b72616a65652d6c6f676f2d622e706e67) ](http://demos.krajee.com "Krajee Demos")
 yii2-money ---

 [ ![Donate](https://camo.githubusercontent.com/4af77d425ca202e55ab3d711b438e238ded194735bc345a019ac060e03e26227/687474703a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67) ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal")
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii2-money--------------------)

[![Latest Stable Version](https://camo.githubusercontent.com/d899bf5dba8e9053999c69c5397555fb37aaf666f76c7236839b60f235e1be1b/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6d6f6e65792f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-money)[![License](https://camo.githubusercontent.com/e19bb2373becb6519dc8f933cdcd7f713e508aa49e9aad76e1b30794177cae52/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6d6f6e65792f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-money)[![Total Downloads](https://camo.githubusercontent.com/47291ec2d5253457e07a631de7726179e7ef7d727b00fed0c8b07dd46d5d4318/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6d6f6e65792f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-money)[![Monthly Downloads](https://camo.githubusercontent.com/93585fe6abaed8b34b81cf004bfe1fd3537bc461583379b85bd34c197f70e013/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6d6f6e65792f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-money)[![Daily Downloads](https://camo.githubusercontent.com/ef8b03d28930532b94d86860405c8dafffcb7f810847a120e437a0acdb93d576/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6d6f6e65792f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-money)

> ### Note
>
> [](#note)
>
> This extension has been replaced with the [yii2-number](https://github.com/kartik-v/yii2-number) extension since Jan 2018. This extension will not be enhanced further or supported. Recommend to head over to [yii2-number extension docs and demos](http://demos.krajee.com/number) for enhanced number management functionality for Yii2.

An advanced money mask input for Yii Framework 2 based on [jQuery-maskMoney plugin](https://github.com/plentz/jquery-maskmoney). The plugin offers a simple way to create masks to your currency form fields. The yii2-money extension includes these additional enhancements in order to use the maskMoney plugin effectively:

- default styling for Bootstrap 3 and supports Yii Active Field validations
- automatically read a float/decimal and convert it to the money format on field load
- automatically convert back the field to a float/decimal for saving once the mask is changed (maintains an internal hidden field)
- allows global settings of the mask money plugin options via `Yii::$app->params`

### Demo

[](#demo)

You can see detailed [documentation](http://demos.krajee.com/money) on usage of the extension.

### Latest Release

[](#latest-release)

The latest version of the extension is release v1.2.2. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-money/blob/master/CHANGE.md) for details of various releases.

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

[](#installation)

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

> Note: Check the [composer.json](https://github.com/kartik-v/yii2-money/blob/master/composer.json) for this extension's requirements and dependencies. Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

Either run

```
$ php composer.phar require kartik-v/yii2-money "dev-master"

```

or add

```
"kartik-v/yii2-money": "dev-master"

```

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

Usage
-----

[](#usage)

### Global Settings

[](#global-settings)

You can globally set the plugin options for your money format across the application in the params section of your Yii configuration file. You need to set the `maskMoneyOptions` in your Yii application params. For example:

```
'params' => [
    'maskMoneyOptions' => [
        'prefix' => 'US$ ',
        'suffix' => ' c',
        'affixesStay' => true,
        'thousands' => ',',
        'decimal' => '.',
        'precision' => 2,
        'allowZero' => false,
        'allowNegative' => false,
    ]
]
```

### Formatter Settings

[](#formatter-settings)

If you have not setup params like above, the plugin will default the `thousandSeparator` and `decimalSeparator`from `Yii::$app->formatter` settings in your configuration file.

```
'components' => [
    'formatter' => [
        'class' => 'yii\i18n\formatter',
        'thousandSeparator' => ',',
        'decimalSeparator' => '.',
    ]
]
```

### MaskMoney

[](#maskmoney)

You can configure the widget as shown below. Any plugin option not passed, will be defaulted from the above two sections (params and formatter). Note that properties directly set in `pluginOptions` at the widget level as shown below, will override other global settings.

```
use kartik\money\MaskMoney;
echo MaskMoney::widget([
    'name' => 'currency',
    'value' => 122423.18,
    'pluginOptions' => [
        'prefix' => '$ ',
    ],
]);
```

License
-------

[](#license)

**yii2-money** is released under the BSD 3-Clause License. See the bundled `LICENSE.md` for details.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

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 ~183 days

Recently: every ~353 days

Total

9

Last Release

2778d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3592619?v=4)[Kartik Visweswaran](/maintainers/kartik-v)[@kartik-v](https://github.com/kartik-v)

---

Top Contributors

[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (28 commits)")[![ricpelo](https://avatars.githubusercontent.com/u/616169?v=4)](https://github.com/ricpelo "ricpelo (3 commits)")[![wbraganca](https://avatars.githubusercontent.com/u/1946359?v=4)](https://github.com/wbraganca "wbraganca (1 commits)")

---

Tags

moneycurrencyformatjqueryyii2extensionwidgetbootstrapbootstrap 3mask

### Embed Badge

![Health badge](/badges/kartik-v-yii2-money/health.svg)

```
[![Health](https://phpackages.com/badges/kartik-v-yii2-money/health.svg)](https://phpackages.com/packages/kartik-v-yii2-money)
```

###  Alternatives

[kartik-v/yii2-date-range

An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.

894.4M42](/packages/kartik-v-yii2-date-range)[kartik-v/yii2-widget-rating

A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)

444.1M8](/packages/kartik-v-yii2-widget-rating)[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)[kartik-v/yii2-sortable

Create sortable lists and grids using HTML5 drag and drop API for Yii 2.0.

433.8M13](/packages/kartik-v-yii2-sortable)[kartik-v/yii2-widget-switchinput

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle switchinputes (sub repo split from yii2-widgets)

384.4M13](/packages/kartik-v-yii2-widget-switchinput)[kartik-v/yii2-widget-sidenav

An enhanced side navigation menu styled for bootstrap (sub repo split from yii2-widgets)

364.0M8](/packages/kartik-v-yii2-widget-sidenav)

PHPackages © 2026

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