yiisoft/yii2-maskedinput Masked input extension for the Yii framework


Masked Input Extension for Yii 2

  1. Installation
  2. Usage

This is the Masked Input extension for Yii framework 2.1. It provides a masked input widget based on jQuery Input Mask plugin.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads Build Status


The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiisoft/yii2-maskedinput

or add

"yiisoft/yii2-maskedinput": "~1.0.0"

to the require section of your composer.json file.

Note that this package contains the MaskedInput widget for Yii versions 2.1 or above, in 2.0 the widget is bundled with the framework package, so no additional install is needed.


To use MaskedInput, you must set the mask property. The following example shows how to use MaskedInput to collect phone numbers:

echo MaskedInput::widget([
    'name' => 'phone',
    'mask' => '999-999-9999',

You can also use this widget in an ActiveForm using the ActiveField::widget() method, for example like this:

<?= $form->field($model, 'from_date')->widget(yii\widgets\MaskedInput::class, [
    'mask' => '999-999-9999',
]) ?>
0 0
1 follower
Yii Version: Unknown
License: BSD-3-Clause
Category: User Interface
Developed by: The Yii Team
Created on: Apr 8, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions