PHPackages                             tim-vdv/yii2-login-attempts-behavior - 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. tim-vdv/yii2-login-attempts-behavior

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

tim-vdv/yii2-login-attempts-behavior
====================================

Disable login after multiple failures.

1.0.3(8y ago)067PHP

Since Oct 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tim-vdv/yii2-login-attempts-behavior)[ Packagist](https://packagist.org/packages/tim-vdv/yii2-login-attempts-behavior)[ RSS](/packages/tim-vdv-yii2-login-attempts-behavior/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (4)Dependencies (1)Versions (9)Used By (0)

Yii2 Login Attempts Behavior
============================

[](#yii2-login-attempts-behavior)

Store login failures, and disable after multiple failures.

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

[](#installation)

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

Either run

```
composer require tim-vdv/yii2-login-attempts-behavior
```

or add

```
"tim-vdv/yii2-login-attempts-behavior": "*"
```

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

Usage
=====

[](#usage)

Run the following migration

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

```

Add the behavior to your login model.

```
public function behaviors()
{
    $behaviors = parent::behaviors();

    $behaviors[] = [
        'class' => '\timvdv\loginattempts\LoginAttemptBehavior',

        // Amount of attempts in the given time period
        'attempts' => 3,

        // the duration, for a regular failure to be stored for
        // resets on new failure
        'duration' => 300,

        // the unit to use for the duration
        'durationUnit' = 'second',

        // the duration, to disable login after exceeding `attemps`
        'disableDuration' => 900,

        // the unit to use for the disable duration
        'disableDurationUnit' => 'second',

        // the attribute used as the key in the database
        // and add errors to
        'usernameAttribute' => 'email',

        // the attribute to check for errors
        'passwordAttribute' => 'password',

        // the validation message to return to `usernameAttribute`
        'message' => 'Login disabled',
    ];

    return $behaviors;
}
```

Todo
====

[](#todo)

- Add cache storage
- Add better DB support
- Add option for IP (other?) instead of key
- Add failure delay option
- More customisable

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~13 days

Recently: every ~3 days

Total

8

Last Release

3035d ago

Major Versions

0.1.3 → 1.02018-01-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/12c66aa46cb46e9e71a71064d8c02ea220838971dc77e34de6c3e65229312ca5?d=identicon)[tim-vdv](/maintainers/tim-vdv)

---

Top Contributors

[![tim-vdv](https://avatars.githubusercontent.com/u/5955291?v=4)](https://github.com/tim-vdv "tim-vdv (12 commits)")

---

Tags

yii2Behavior

### Embed Badge

![Health badge](/badges/tim-vdv-yii2-login-attempts-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/tim-vdv-yii2-login-attempts-behavior/health.svg)](https://phpackages.com/packages/tim-vdv-yii2-login-attempts-behavior)
```

###  Alternatives

[yii2mod/yii2-rbac

RBAC management module for Yii2

150351.4k7](/packages/yii2mod-yii2-rbac)[giannisdag/yii2-check-login-attempts

Disable login after multiple failures.

2254.2k](/packages/giannisdag-yii2-check-login-attempts)[ethercreative/yii2-login-attempts-behavior

Disable login after multiple failures.

104.6k](/packages/ethercreative-yii2-login-attempts-behavior)[rmrevin/yii2-ulogin

Extension for yii2 ulogin integration

1811.9k](/packages/rmrevin-yii2-ulogin)[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

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