PHPackages                             kartik-v/yii2-password - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. kartik-v/yii2-password

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

kartik-v/yii2-password
======================

Useful password strength validation utilities for Yii Framework 2.0

v1.5.7(4y ago)791.2M↓14.9%44[1 issues](https://github.com/kartik-v/yii2-password/issues)17BSD-3-ClausePHP

Since Mar 6Pushed 4y ago5 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (15)Used By (17)

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

 [![Donate](https://camo.githubusercontent.com/0336bc43d88554a3f2d6c74dddf312bc2c65c2eacca70d83ae40f5567098d00e/68747470733a2f2f6b617274696b2d762e6769746875622e696f2f626f6f7473747261702d66696c65696e7075742d73616d706c65732f73616d706c65732f646f6e6174652e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU "Donate via Paypal") [![kartikv](https://camo.githubusercontent.com/0cf29a542375e1a46e84d8bf5805a4e5c0a6ee98b6547ccdc0c55eed49d99c69/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d79656c6c6f772e706e67)](https://www.buymeacoffee.com/kartikv "Buy me a coffee")
================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#------------------------yii2-password------------------)

[![Stable Version](https://camo.githubusercontent.com/9c76c72fabcb2f19baadc071d9a8f5653c12fe09a7766de2bbcaf9ab3465730e/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d70617373776f72642f762f737461626c65)](https://packagist.org/packages/kartik-v/yii2-password)[![Untable Version](https://camo.githubusercontent.com/71bc79fae0bcee0aef624cbc5cdaf65dc7396bf57e57882d91319e49bf372b4c/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d70617373776f72642f762f756e737461626c65)](https://packagist.org/packages/kartik-v/yii2-password)[![License](https://camo.githubusercontent.com/1a21981c0759d48ac087f15073bee1fe1d2bbfa34c4b881f0c5bc3545788a1b2/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d70617373776f72642f6c6963656e7365)](https://packagist.org/packages/kartik-v/yii2-password)[![Total Downloads](https://camo.githubusercontent.com/797636587ab9647e18f2a84327f13981245d5efe8cfc4a6e1c505351d6777a51/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d70617373776f72642f646f776e6c6f616473)](https://packagist.org/packages/kartik-v/yii2-password)[![Monthly Downloads](https://camo.githubusercontent.com/37d0584a4295c57f33a8102a969c40f157eacee1cf76f1db2b226b549950c391/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d70617373776f72642f642f6d6f6e74686c79)](https://packagist.org/packages/kartik-v/yii2-password)[![Daily Downloads](https://camo.githubusercontent.com/8a6bcf04c08cc6f491b976e8c5ce40f137e224ab0ad35e67f4e65aca7b90560e/68747470733a2f2f706f7365722e707567782e6f72672f6b617274696b2d762f796969322d70617373776f72642f642f6461696c79)](https://packagist.org/packages/kartik-v/yii2-password)

This extension provides a couple of great password management utilities for Yii Framework 2.0. The extension allows password strength validation through your model. In addition, it provides an advanced password input widget, that allows you to display/hide text and show the password strength.

### Release Changes

[](#release-changes)

Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-password/blob/master/CHANGE.md) for details of various releases.

### Prerequisites

[](#prerequisites)

- Ensure you have the right version of jQuery loaded (&gt; v1.9.0).
- In case you are upgrading from an older release, its recommended that you clean up your web assets, local browser cache, and restart your browsers before using the extension.

### StrengthValidator

[](#strengthvalidator)

[`VIEW DEMO`](http://demos.krajee.com/password-details/strength-validator)
This is a password strength validator for your model attributes. The strength validator allows you to configure the following parameters for validating passwords or strings.

1. Whether password contains an username
2. Whether password contains an email string
3. Minimum number of characters
4. Maximum number of characters
5. Whether spaces are allowed
6. Minimum number of lower space characters
7. Minimum number of upper space characters
8. Minimum number of numeric / digit characters
9. Minimum number of special characters
10. Whether password is compromised and part of [Have I Been Pwned](https://haveibeenpwned.com/) lists.

Other features:

1. Includes 5 presets (simple, normal, fair, medium, and strong). Instead of setting each parameter above, you can call a preset which will auto-set each of the parameters above.
2. It includes both server and client validation.
3. This can work with the PasswordInput widget (described next) as per your needs. The strength validation routines for both are a bit different. The PasswordInput widget focuses on displaying the strength only, and does not restrict the user input in any way.

> NOTE: The StrengthValidator does not validate if the password field is required. You need to use Yii's `required` rule for this.

### PasswordInput

[](#passwordinput)

[`VIEW DEMO`](http://demos.krajee.com/password-details/password-input)
This is an advanced password input widget with configurable options and a dynamic strength meter based on the [Strength Meter JQuery Plugin](http://plugins.krajee.com/strength-meter) by Krajee. The widget provides various features as mentioned below:

1. Allows you to show/ hide a password text (using bootstrap styled input addons). You can configure this option to be shown or not.
2. Allows you to display an advanced password strength meter to calculate and show your password strength as you type.
3. Allows you to control and position/style your meter based on templates.
4. A password strength meter consists of the meter bar, the score, and the verdict.
5. Uses Bootstrap 3.0 styling wherever possible with inbuilt Yii 2.0 ActiveField functionality.
6. Works independent and complements the StrengthValidator.

### Demo

[](#demo)

You can see a [demonstration here](http://demos.krajee.com/password) on usage of these functions with documentation and examples.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

> Note: Check the [composer.json](https://github.com/kartik-v/yii2-password/blob/master/composer.json) for this extension's requirements and dependencies. Read this [web tip /wiki](http://webtips.krajee.com/setting-composer-minimum-stability-application/) on setting the `minimum-stability` settings for your application's composer.json.

Either run

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

```

or add

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

```

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

Usage
-----

[](#usage)

### StrengthValidator

[](#strengthvalidator-1)

```
// add this in your model
use kartik\password\StrengthValidator;

// use the validator in your model rules
public function rules() {
    return [
       	[['username', 'password'], 'required'],
       	[['password'], StrengthValidator::className(), 'preset'=>'normal', 'userAttribute'=>'username']
    ];
}
```

### PasswordInput

[](#passwordinput-1)

```
// add this in your view
use kartik\password\PasswordInput;
use kartik\widgets\ActiveForm; // optional

$form = ActiveForm::begin(['id' => 'login-form']);
echo $form->field($model,'username');
echo $form->field($model, 'password')->widget(PasswordInput::classname(), [
    'pluginOptions' => [
        'showMeter' => true,
        'toggleMask' => false
    ]
]);
```

License
-------

[](#license)

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

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community37

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 84.9% 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 ~249 days

Recently: every ~579 days

Total

13

Last Release

1464d 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 (157 commits)")[![tibee](https://avatars.githubusercontent.com/u/3636947?v=4)](https://github.com/tibee "tibee (2 commits)")[![igosja](https://avatars.githubusercontent.com/u/18279735?v=4)](https://github.com/igosja "igosja (2 commits)")[![AnniG](https://avatars.githubusercontent.com/u/3613588?v=4)](https://github.com/AnniG "AnniG (2 commits)")[![pxao02](https://avatars.githubusercontent.com/u/20340929?v=4)](https://github.com/pxao02 "pxao02 (2 commits)")[![vihugarcia](https://avatars.githubusercontent.com/u/5471053?v=4)](https://github.com/vihugarcia "vihugarcia (2 commits)")[![sam002](https://avatars.githubusercontent.com/u/2215228?v=4)](https://github.com/sam002 "sam002 (2 commits)")[![jurchiks](https://avatars.githubusercontent.com/u/542788?v=4)](https://github.com/jurchiks "jurchiks (1 commits)")[![kosli](https://avatars.githubusercontent.com/u/203928?v=4)](https://github.com/kosli "kosli (1 commits)")[![petrleocompel](https://avatars.githubusercontent.com/u/9423543?v=4)](https://github.com/petrleocompel "petrleocompel (1 commits)")[![pigochu](https://avatars.githubusercontent.com/u/1013744?v=4)](https://github.com/pigochu "pigochu (1 commits)")[![spapad](https://avatars.githubusercontent.com/u/7470875?v=4)](https://github.com/spapad "spapad (1 commits)")[![TonisOrmisson](https://avatars.githubusercontent.com/u/6357451?v=4)](https://github.com/TonisOrmisson "TonisOrmisson (1 commits)")[![udokmeci](https://avatars.githubusercontent.com/u/8896298?v=4)](https://github.com/udokmeci "udokmeci (1 commits)")[![uniquexor](https://avatars.githubusercontent.com/u/6176836?v=4)](https://github.com/uniquexor "uniquexor (1 commits)")[![aadutskevich](https://avatars.githubusercontent.com/u/7986377?v=4)](https://github.com/aadutskevich "aadutskevich (1 commits)")[![vilkh3m](https://avatars.githubusercontent.com/u/1915186?v=4)](https://github.com/vilkh3m "vilkh3m (1 commits)")[![dungphanxuan](https://avatars.githubusercontent.com/u/10725732?v=4)](https://github.com/dungphanxuan "dungphanxuan (1 commits)")[![freetuts](https://avatars.githubusercontent.com/u/7605140?v=4)](https://github.com/freetuts "freetuts (1 commits)")[![hubunator](https://avatars.githubusercontent.com/u/5107121?v=4)](https://github.com/hubunator "hubunator (1 commits)")

---

Tags

authpasswordjqueryyii2extensionyiibootstrapforminputstrength

### Embed Badge

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

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

###  Alternatives

[kartik-v/yii2-markdown

Advanced Markdown editing and conversion utilities for Yii Framework 2.0

88265.8k6](/packages/kartik-v-yii2-markdown)[kartik-v/yii2-widget-rating

A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)

444.1M8](/packages/kartik-v-yii2-widget-rating)[kartik-v/yii2-widget-switchinput

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle switchinputes (sub repo split from yii2-widgets)

384.4M13](/packages/kartik-v-yii2-widget-switchinput)[kartik-v/yii2-widget-fileinput

An enhanced FileInput widget for Bootstrap 3.x, 4.x &amp; 5.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

2286.8M95](/packages/kartik-v-yii2-widget-fileinput)[kartik-v/yii2-widget-touchspin

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle touchspines (sub repo split from yii2-widgets)

184.1M6](/packages/kartik-v-yii2-widget-touchspin)[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)

PHPackages © 2026

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