Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

yiisoft/yii-masked-input

This package is deprecated.


Yii Framework Masked input widget Extension


This is the Masked Input extension for Yii framework. 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

Installation

The preferred way to install this extension is through composer.

composer require --prefer-dist yiisoft/yii-masked-input

Usage

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()|widget()]] method, for example like this:

<?= $form
    ->field($model, 'from_date')
    ->widget(Yiisoft\Yii\MaskedInput\MaskedInput::class, [
        'mask' => '999-999-9999',
    ]) ?>