PHPackages                             kartik-v/yii2-number - 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. [Templating &amp; Views](/categories/templating)
4. /
5. kartik-v/yii2-number

ActiveYii2-extension[Templating &amp; Views](/categories/templating)

kartik-v/yii2-number
====================

Number control and format mask input for Yii2 Framework.

v1.0.5(7y ago)22498.3k—10%3[3 issues](https://github.com/kartik-v/yii2-number/issues)12BSD-3-ClausePHP

Since Jan 30Pushed 6y ago3 watchersCompare

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

READMEChangelog (6)Dependencies (1)Versions (7)Used By (12)

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

 [ ![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-number--------------------)

[![Latest Stable Version](https://camo.githubusercontent.com/40d7a8d3fa7a7a1710658d00b74545ee9c9271081b3a4e1808c8e77d778ae23b/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6e756d6265722f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-number)[![Latest Unstable Version](https://camo.githubusercontent.com/7cb81b413a0b7a691a8e4fedd87e7979965c2ea115868084baea871910c6bd4f/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6e756d6265722f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-number)[![License](https://camo.githubusercontent.com/47d6bf23f96d4e792f48f46b81a481e5799ad57d9cf49a3f5adda6bbfacacb84/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6e756d6265722f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-number)[![Total Downloads](https://camo.githubusercontent.com/2b8df90405cb4fe65319e60122d7a4133f4af795432aa639e2b21289726a1022/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6e756d6265722f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-number)[![Monthly Downloads](https://camo.githubusercontent.com/e11d522316889a5e42ee29870f0b448071f7c1904fdfbae680723abd7736e1d5/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6e756d6265722f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-number)[![Daily Downloads](https://camo.githubusercontent.com/29dd6e64642d26542bb4b66567465a319195f4828e32e4e90b25178aa52f1041/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d6e756d6265722f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-number)

> ### Note
>
> [](#note)
>
> This extension replaces the [yii2-money](https://github.com/kartik-v/yii2-money) extension since Jan 2018. The [yii2-money](https://github.com/kartik-v/yii2-money) extension will not be enhanced further or supported.

A number control input for Yii2 Framework that uses the [jQuery input mask plugin](https://github.com/RobinHerbots/Inputmask) (available also via `yii/widgets/MaskedInputAsset`) to render number input masks. This extension is similar to the [DateControl extension](http://demos.krajee.com/datecontrol) for dates, and allows one to control the display and save formats for numbers. The extension thus allows one to setup a number format display mask, use currency prefixes if needed, and modify the decimals and thousand separators. It lastly allow the display fields to be auto calculated as numbers when stored into the database.

Refer [detailed documentation and demos](http://demos.krajee.com/number).

Release Updates
---------------

[](#release-updates)

Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-number/blob/master/CHANGE.md) for updates and changes to various releases.

### Install

[](#install)

Either run

```
$ php composer.phar require kartik-v/yii2-number "@dev"

```

or add

```
"kartik-v/yii2-number": "@dev"

```

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

Usage
-----

[](#usage)

```
use kartik\number\NumberControl;

// Normal decimal
echo NumberControl::widget([
    'name' => 'normal-decimal',
    'value' => 43829.39,
]);

// Integer only
echo NumberControl::widget([
    'name' => 'integer-only',
    'value' => 32892,
    'maskedInputOptions' => ['digits' => 0],
]);

// Currency style with prefix and suffix
echo NumberControl::widget([
    'name' => 'currency-num',
    'value' => 2018032.22,
    'maskedInputOptions' => ['prefix' => '$ ', 'suffix' => ' c'],
]);

// Usage with model
$model->currency = 1298132.23;
echo NumberControl::widget([
    'model' => $model,
    'attribute' => 'currency',
    'maskedInputOptions' => ['prefix' => '$ ', 'suffix' => ' c'],
]);
```

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~62 days

Recently: every ~55 days

Total

6

Last Release

2720d 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 (18 commits)")[![kevocde](https://avatars.githubusercontent.com/u/17850491?v=4)](https://github.com/kevocde "kevocde (1 commits)")

---

Tags

displayformatkartikkartik-vkrajeemasknumbersavewidgetyii2currencyformatyii2extensionwidgetnumbermasknumber control

### Embed Badge

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

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

###  Alternatives

[kartik-v/yii2-widget-select2

Enhanced Yii2 wrapper for the Select2 jQuery plugin (sub repo split from yii2-widgets).

3279.7M191](/packages/kartik-v-yii2-widget-select2)[kartik-v/yii2-money

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

29915.4k10](/packages/kartik-v-yii2-money)[kartik-v/yii2-widget-activeform

Enhanced Yii2 active-form and active-field with full bootstrap styling support (sub repo split from yii2-widgets).

647.3M62](/packages/kartik-v-yii2-widget-activeform)[kartik-v/yii2-detail-view

Enhanced Yii 2 Detail View widget with special Bootstrap styles, ability to edit data, and more.

701.1M41](/packages/kartik-v-yii2-detail-view)

PHPackages © 2026

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