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

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

ethercreative/yii2-login-attempts-behavior
==========================================

Disable login after multiple failures.

0.1.3(8y ago)104.9k8[1 issues](https://github.com/ethercreative/yii2-login-attempts-behavior/issues)PHP

Since Oct 23Pushed 3y ago2 watchersCompare

[ Source](https://github.com/ethercreative/yii2-login-attempts-behavior)[ Packagist](https://packagist.org/packages/ethercreative/yii2-login-attempts-behavior)[ RSS](/packages/ethercreative-yii2-login-attempts-behavior/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (5)Used By (0)

⚠️ This repo is no longer being maintained.
-------------------------------------------

[](#️-this-repo-is-no-longer-being-maintained)

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 ethercreative/yii2-login-attempts-behavior
```

or add

```
"ethercreative/yii2-login-attempts-behavior": "*"
```

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

Usage
=====

[](#usage)

Run the following migration

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

```

Add the behavior to your login model.

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

    $behaviors[] = [
        'class' => '\ethercreative\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

33

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~27 days

Total

4

Last Release

3094d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/807df0a17d1291238650a6652a05231e0eecc1e7236480762cbb674a6fe61198?d=identicon)[mattether](/maintainers/mattether)

---

Top Contributors

[![archlemon](https://avatars.githubusercontent.com/u/9592740?v=4)](https://github.com/archlemon "archlemon (2 commits)")[![alexjcollins](https://avatars.githubusercontent.com/u/12031196?v=4)](https://github.com/alexjcollins "alexjcollins (1 commits)")[![djbuch](https://avatars.githubusercontent.com/u/5637724?v=4)](https://github.com/djbuch "djbuch (1 commits)")[![jonasformolo](https://avatars.githubusercontent.com/u/13522832?v=4)](https://github.com/jonasformolo "jonasformolo (1 commits)")

---

Tags

yii2Behavior

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[giannisdag/yii2-check-login-attempts

Disable login after multiple failures.

2258.1k](/packages/giannisdag-yii2-check-login-attempts)[rmrevin/yii2-ulogin

Extension for yii2 ulogin integration

1812.0k](/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)
