PHPackages                             heimo/yii2-rbac - 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. heimo/yii2-rbac

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

heimo/yii2-rbac
===============

RBAC Lite for Yii2

v1.0.4(7y ago)0451MITPHP

Since Jul 20Pushed 7y agoCompare

[ Source](https://github.com/Heimo-He/yii2-rbac)[ Packagist](https://packagist.org/packages/heimo/yii2-rbac)[ RSS](/packages/heimo-yii2-rbac/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

yii2-rbac
=========

[](#yii2-rbac)

> Yii2 rbac 精简版(无对外接口) **仅供无需rbac接口的api应用使用**根据[yii2-rest-rbac（https://github.com/windhoney/yii2-rest-rbac）](https://github.com/windhoney/yii2-rest-rbac)修改

### **安装**

[](#安装)

```
composer require heimo/yii2-rbac
```

### **使用**

[](#使用)

#### **配置权限**

[](#配置权限)

```
    'components' => [
        'authManager' => [
            'class' => 'heimo\rbac\components\DbManager', //配置文件
        ],
    ],

    'as access' => [
        'class' => 'heimo\rbac\components\AccessControl',
        'allowActions' => [//允许访问的节点，可自行添加
            'login/*',
            'logout/*',
            'callback/*',
        ]
    ],
```

#### **创建所需要的表**

[](#创建所需要的表)

1. 菜单表menu

```
yii migrate --migrationPath=@vendor/heimo/yii2-rbac/migrations
```

2. rbac相关权限表

```
yii migrate --migrationPath=@yii/rbac/migrations/
```

#### **授权认证方式**

[](#授权认证方式)

1. url中增加 `access_token` 参数 或者 header中增加 `Authorization` 参数，值为 `Bearer [access_token值]`
2. UserModel中实现 `loginByAccessToken($access_token)` 方法

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

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

Total

5

Last Release

2786d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22815251?v=4)[Emil Kalapov](/maintainers/Heimo)[@Heimo](https://github.com/Heimo)

---

Top Contributors

[![Heimo-He](https://avatars.githubusercontent.com/u/26212318?v=4)](https://github.com/Heimo-He "Heimo-He (3 commits)")

---

Tags

authrbacyiiadminrestful

### Embed Badge

![Health badge](/badges/heimo-yii2-rbac/health.svg)

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

###  Alternatives

[windhoney/yii2-rest-rbac

RBAC Auth manager for Yii2 RESTful

811.2k](/packages/windhoney-yii2-rest-rbac)[izyue/yii2-admin

RBAC Auth manager for Yii2

401.8k1](/packages/izyue-yii2-admin)

PHPackages © 2026

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