Yii2-Login Attempts

Yii2-Login Attempts is a checker for login attempts based on store login failures, and disable after multiple failures. In this tutorial, we will show you how to limit login attempts in Yii2, which means, if a user try to login with an invalid password more than 3 times, the system will lock the user and make it unable to login anymore.

 3 easy step to enable login attempts:

  • Install Yii2-Login Attempts extension is through composer.
  • Run the migration.
  • Add the behavior to your login model.


Yii2-Login Attempts – Installation

The preferred way to install this extension is through composer.

Either run

composer require ethercreative/yii2-login-attempts-behavior
or add
"ethercreative/yii2-login-attempts-behavior": "*"

to the require section of your composer.json file.

Yii2-Login Attempts - Composer



Run the following migration

yii migrate --migrationPath="vendor/ethercreative/yii2-login-attempts-behavior/src/migrations" --interactive=0

Yii2-Login Attempts - Migrate


Yii2-Login Attempts

Add the behavior to your login model.



Yii2-Login Attempts - 3 Times


Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.