mrssoft/yii2-form-widgets

Yii2 widgets for form fields

Installs: 133

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

2.1.7 2023-11-09 05:56 UTC

This package is auto-updated.

Last update: 2024-11-09 08:10:00 UTC


README

Latest Stable Version PHP Total Downloads

Yii2 widgets for form fields

Input widgets:

  • PasswordRevealWidget
  • PhoneInputWidget
  • MaskedPhoneInputWidget

Validators:

  • PhoneValidator

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist mrssofy/yii2-form-widgets "~2.0"

or add

"mrssofy/yii2-form-widgets": "~2.0"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by:

$form->field($order, 'name')->widget(NameInputWidget::class);
$form->field($order, 'phone')->widget(PhoneInputWidget::class);
$form->field($order, 'password')->widget(PasswordRevealWidget::class);
public function rules()
{
    return [
        [['phone'], 'required'],
        [['phone'], PhoneValidator::class, 'returnLenght' => 10],
        ...
    ];
}