PHPackages                             oldfurybird/rabc - 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. oldfurybird/rabc

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

oldfurybird/rabc
================

 role based permission control

v0.1(8y ago)110MITPHPPHP &gt;=5.5.0

Since Apr 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/oldFuryBird/rabc)[ Packagist](https://packagist.org/packages/oldfurybird/rabc)[ RSS](/packages/oldfurybird-rabc/feed)WikiDiscussions master Synced 2mo ago

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

rabc
====

[](#rabc)

基于角色管理权限扩展
----------

[](#基于角色管理权限扩展)

require laravel:~5.6

### 安装

[](#安装)

` composer require oldfurybird/rabc`

或

`git clone git@github.com:oldFuryBird/rabc.git vendor/oldfurybird/rabc/`

### 使用

[](#使用)

1. 注册服务，在 config\\app 中

```
      'providers'=>[
          ...
        /*
         * Package Service Providers...
         */
         Rabc\RabcServiceProvider::class,
        ...
      ],
```

2. 默认使用 App\\User 模型作为用户模型 可以在config/rabc.php 中修改
3. 当用户表migrate成功之后

`php artisan rabc:install`

允许mirgrate

### User 需要implements UserInterface接口

[](#user-需要implements-userinterface接口)

- hasRole()
- roles($role\_name)
- can($permission\[s\]) 能否通过权限测试
- attachRole\[s\]/detachRole\[s\] 添加删除角色 通过 use Rabc\\RabcUserTrait trait 具体实现

### middleware

[](#middleware)

```
在Kernel.php 添加中间件  Rabc\Middleware\TrustRole,Rabc\Middleware\TrustPermission
控制路由访问权限等功能
$this->middleware('role:test|test_2'); // test或test_2角色可以访问
$this->middleware('perm:test1');// test1 权限通过的用户可以访问

```

### 实例

[](#实例)

```
 $role = Role::create(['name'=>'test','display_name'=>'测试','description'=>'能否通过?']);
 $user->attachRole($role);
 $user->hasRole('test');//true;
 $user->can('test_perm');//false;

 $permission = Permission::create(['name'=>'test_perm','display_name'=>'测试权限','description'=>'能否通过?']);
 $role->attachPermission($permission);
 $user->can('test_perm');//true;
```

反馈
--

[](#反馈)

如果您有任何建议和意见可以给我issue或者反馈[ccwc3@163.com](ccwc3@163.com)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

2949d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66fe02fa67e080399fdd2f069d287b509170386da075101a1ff2e2027951dce7?d=identicon)[oldFuryBird](/maintainers/oldFuryBird)

---

Top Contributors

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

---

Tags

laravelauthaclpermissionrolesilluminate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oldfurybird-rabc/health.svg)

```
[![Health](https://phpackages.com/badges/oldfurybird-rabc/health.svg)](https://phpackages.com/packages/oldfurybird-rabc)
```

###  Alternatives

[codebot/entrust

This package provides a flexible way to add Role-based Permissions to Laravel

1596.6k](/packages/codebot-entrust)

PHPackages © 2026

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