Yii2 Password

This is a discussion forum for the yii2-password extension. The extension provides a couple of great password management utilities for Yii Framework 2.0. It has a separate StrengthValidator that allows password strength validation through your model. In addition, it also provides an advanced password input widget, that allows you to display/hide text and show the password strength. You can view the documentation and demos of the StrengthValidator and the PasswordInput widget in action.

Awesome to see Yii2 extensions being created already. Thanks for the release!

Thanks. Yes. This should be a much better and expected release of Yii to work with.

Resolved issue of toggle mask not validating/showing Password with multiple widgets on same page (as pointed out by DocSnyder).

Currently, the widget allows multiple widgets on same page in which you can control the display of the strength meter and toggle Mask.

Translation into languages will be taken up as an enhancement. Will appreciate anyone volunteering for translations into languages.

i can spend German …

Internationalization and translations for both StrengthValidator and PasswordInput have been implemented. Tested for French messages (translations courtesy Google translate) and the message files are included. You can submit a Pull Request for other languages. I have included a skeleton template for German (DE) messages.

[size="3"]PasswordInput[/size] has been enhanced now to work with ActiveField in a better way (no more need of passing $form property). In addition, you can now use this widget with or without an ActiveForm or model. Please change your codes in case you are using these widgets.

For example:

// add this in your view

use kartik\password\PasswordInput;

// Usage with ActiveForm

echo $form->field($model, 'password')->widget(


    ['showMeter' => true]


// Usage with model and without ActiveForm 

echo PasswordInput::widget([

    'model' => $model, 

    'attribute' => 'password_1',

    'showMeter' => true,


// Usage without a model or ActiveForm

echo PasswordInput::widget([

    'name' => 'password_2',

    'showMeter' => true,


Extension upgraded to version 2.0. PasswordInput widget uses the newly created Strength Meter JQuery plugin. View the plugin documentation and/or demo.

For the PasswordInput widget, check documentation or view a demo.

Older version has been relegated to a version1.0 branch on github. Users upgrading to version 2.0 — please see the documentation for usage.

A quick comment

I was following the sample code found at https://demos.krajee.com/password-details/password-input and it should be revised as

use kartik\widgets\PasswordInput

is no longer valid and should be (as you have indicated earlier in this thread)

use kartik\password\PasswordInput;