PHPackages                             buddysoft/yii2-history - 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. buddysoft/yii2-history

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

buddysoft/yii2-history
======================

Simple user login history views, use `afterLogin` event to record every user login.

v1.0.0(7y ago)02Apache-2.0PHPPHP &gt;=5.6.15

Since Oct 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/liuwanwei/yii2-history)[ Packagist](https://packagist.org/packages/buddysoft/yii2-history)[ Docs](https://github.com/liuwanwei/yii2-history)[ RSS](/packages/buddysoft-yii2-history/feed)WikiDiscussions master Synced yesterday

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

简介
--

[](#简介)

为 Yii2 封装的一个用户登录历史记录添加和展示模块

### 特性

[](#特性)

- 通过 `afterLogin` 事件记录每次用户登录.

### 适用环境

[](#适用环境)

- PHP 5.6 及以上版本
- Yii2.0.7 及以上版本
- MySQL 5.6 及以上版本

使用方法
----

[](#使用方法)

### 1.安装

[](#1安装)

```
#composer require buddysoft/yii2-history

```

### 2.导入数据表

[](#2导入数据表)

```
#cd project_root
#./yii migrate --migrationPath=@buddysoft/history/migrations

```

### 3.配置管理页面模块

[](#3配置管理页面模块)

修改 backend/config/main.php，在 modules 配置中增加 login 模块的定义：

```
'modules' => [
    'history' => [
        'class' => 'buddysoft\history\Module',
    ],
],

```

经过以上配置，就能在浏览中访问配置界面了:

>

跟 Yii2-admin 配合使用时，记得将访问权限添加给管理员用户，或者在测试时加入以下代码。

```
'as access' => [
    'class' => 'mdm\admin\components\AccessControl',
    'allowActions' => [
        'history/*',        // 只有这一行是专有内容
    ],

```

### 4.注册 afterLogin 事件

[](#4注册-afterlogin-事件)

```
'components' => [
    'user' => [
        'identityClass' => 'common\models\User',
        'loginUrl' => ['admin/user/login'],
        'returnUrl' => ['line/index'],
        'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],

        /**
         * 管家配置从这里开始
         */

        // 关闭自动登录，设置登录有效期为 1 天
        'enableAutoLogin' => false,
        'authTimeout' => '86400',   // 一天登录时效
        // 配置登录事件处理
        'on afterLogin' => ['buddysoft\history\handlers\LoginHandler', 'afterLogin'],
    ],
]

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

2

Last Release

2758d ago

Major Versions

v0.0.2 → v1.0.02018-10-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/16d22936eaad779f55f92f099fe68ba14e67990b6c66b83dd278c7143004fc4d?d=identicon)[liuwanwei](/maintainers/liuwanwei)

---

Top Contributors

[![liuwanwei](https://avatars.githubusercontent.com/u/62382?v=4)](https://github.com/liuwanwei "liuwanwei (7 commits)")

### Embed Badge

![Health badge](/badges/buddysoft-yii2-history/health.svg)

```
[![Health](https://phpackages.com/badges/buddysoft-yii2-history/health.svg)](https://phpackages.com/packages/buddysoft-yii2-history)
```

###  Alternatives

[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)
