PHPackages                             fast-api/permission - 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. fast-api/permission

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

fast-api/permission
===================

laravel rbac permission

v1.0.0(5y ago)451MITPHPPHP &gt;=7.2.5

Since Apr 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mliuchengyu/fast-api-permission)[ Packagist](https://packagist.org/packages/fast-api/permission)[ Docs](https://github.com/fast-php/fast-api-permission)[ RSS](/packages/fast-api-permission/feed)WikiDiscussions master Synced 3d ago

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

fast-api/permission
===================

[](#fast-apipermission)

fast-api-permission 是一个PHP RBAC处理和操作库，它提供了一种更容易表达的方式来创建，编辑和管理前后端分离API接口权限。该软件包包括用于轻松集成Laravel的ServiceProviders和Facades 。

更多功能可以参考下面的文档。

在Laravel应用程序中使用官方fast-api/permission客户端的简便方法。

- [安装与配置](#%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE)
    - [安装 Laravel](#%E5%AE%89%E8%A3%85-Laravel)
        - [安装 fast-api/permission](#%E5%AE%89%E8%A3%85-%E6%9D%83%E9%99%90%E6%89%A9%E5%B1%95%E5%8C%85)
        - [配置 laravel .env 文件](#%E9%85%8D%E7%BD%AE-laravel-env-%E6%96%87%E4%BB%B6)
        - [配置 laravel auth 文件](#%E9%85%8D%E7%BD%AE-laravel-auth-%E6%96%87%E4%BB%B6)
- [使用](#%E4%BD%BF%E7%94%A8)
- [启动](#%E5%90%AF%E5%8A%A8)
- [文档](#%E6%96%87%E6%A1%A3)
- [演示](#%E6%BC%94%E7%A4%BA)
- [完整项目](#%E5%AE%8C%E6%95%B4%E9%A1%B9%E7%9B%AE)
- [存储库](#%E5%AD%98%E5%82%A8%E5%BA%93)
- [bug、建议、贡献和支持](#bug-%E5%BB%BA%E8%AE%AE-%E8%B4%A1%E7%8C%AE%E5%92%8C%E6%94%AF%E6%8C%81)
- [版权和许可](#%E7%89%88%E6%9D%83%E5%92%8C%E8%AE%B8%E5%8F%AF)

安装与配置
-----

[](#安装与配置)

Fast-php Cloud Fast-api/Permission SDK for Laravel
==================================================

[](#fast-php-cloud-fast-apipermission-sdk-for-laravel)

安装 Laravel
----------

[](#安装-laravel)

本产品依赖Laravel需要安装 Laravel `laravel/laravel` package via composer:

```
composer create-project --prefer-dist laravel/laravel laravel "7.30.0"
```

安装 权限扩展包
--------

[](#安装-权限扩展包)

```
composer require fast-api/permission dev-master
```

配置 laravel env 文件
-----------------

[](#配置-laravel-env-文件)

在按照上面建议的完成程序的安装之后，下面请配置数据库 通过添加以下内容到您的应用程序'.env文件(带有合适的值):

APP\_URL 服务地址和端口: 项目访问地址，本地开发,参考设置（php artisan serve）终端执行打印信息。

```
APP_URL=http://localhost:8000
```

数据库:

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=fast-api
DB_USERNAME=root
DB_PASSWORD=root
```

API前缀:

如果您曾经使用过API，就会知道大多数服务都是通过子域或前缀提供的。前缀或子域是必需的，但只有一个。避免将版本号作为前缀或子域，因为版本控制是通过Accept标头处理的。 您可以在.env文件中进行配置。

```
API_PREFIX=api
```

配置 laravel auth 文件
------------------

[](#配置-laravel-auth-文件)

```
// Authentication Defaults
'defaults' => [
    'guard' => 'api',
    'passwords' => 'users',
]

// Authentication Guards
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'jwt',
        'provider' => 'users',
        'hash' => false,
    ],
]

// User Providers
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => \Fast\Api\Permission\User::class,
    ],

    // 'users' => [
    //     'driver' => 'database',
    //     'table' => 'users',
    // ],
]
```

使用
--

[](#使用)

发布配置 \[JWT\]

运行以下命令以发布程序包配置文件：

```
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
```

生成密钥

我提供了一个帮助程序命令，可以为您生成密钥：

```
php artisan jwt:secret
```

过期时间:

设置 JWT TOKEN 默认过期时间

您可以在.env文件中进行配置。

```
JWT_EXPIRR_IN = 1440
```

发布配置 \[Captcha\]

运行以下命令以发布程序包配置文件：

```
php artisan vendor:publish --provider="Mews\Captcha\CaptchaServiceProvider"
```

更新config/captcha.php文档配置：

```
'default' => [
    'length' => 4,
    'width' => 150,
    'height' => 47,
    'quality' => 50,
    'math' => false,
    'expire' => 60,
    'encrypt' => false,
]
```

发布配置 \[Swagger\]

```
php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
```

更新config/l5-swagger.php文档配置：

包含权限扩展包文档路径，vendor/fast-api

```
/*
 * Absolute paths to directory containing the swagger annotations are stored.
*/
'annotations' => [
    base_path('app'),
    base_path('vendor/fast-api'),
]
```

.env 文件中配置Swagger参数。

```
L5_SWAGGER_GENERATE_ALWAYS=true
L5_SWAGGER_CONST_HOST=http://127.0.0.1:8000
```

数据迁移 \[migrates\]

运行以下命令以发布程序包配置文件：

```
php artisan migrate --path=vendor/fast-api/permission/database/migrations
```

生成数据 \[seed\]

运行以下命令导入权限数据到数据库：

```
php artisan db:seed --class=AdminUserSeeder
```

bug 建议 贡献和支持
------------

[](#bug-建议-贡献和支持)

请使用[Github](https://github.com/fast-php/fast-api-permission)报告bug，并提出意见或建议。

请参阅[CONTRIBUTING.md](CONTRIBUTING.md)了解如何贡献更改。

启动
--

[](#启动)

运行以下命令启动项目：

```
php artisan serve
```

API文档访问地址:

文档
--

[](#文档)

PHP开发技术交流（QQ群 368868750）

[![PHP开发技术交流 (SDK)](https://camo.githubusercontent.com/d8a86bc02a44a78d23d0746f300d73b0f9bb7e9a1f9eb6af61b2f159525f317d/687474703a2f2f7075622e69647171696d672e636f6d2f7770612f696d616765732f67726f75702e706e67)](https://qm.qq.com/cgi-bin/qm/qr?k=rfRumoZ0fxUN4TdshfjkxiHximnHVSzb&jump_from=webapi)

> fast-api-permission 是基于laravel 7.x 封装，在做项目开发前，必需先阅读laravel官方文档。
>
> - laravel 官方文档：

演示
--

[](#演示)

后台地址：

> 账号: admin
>
> 密码: 123123

API文档：

完整项目
----

[](#完整项目)

后台仓库地址：

> Github
>
>

API仓库地址：

> Github
>
>

存储库
---

[](#存储库)

fast-api-permission 为开源项目，允许把它用于任何地方，不受任何约束，欢迎 fork 项目。

> - GitHub 托管地址：
> - packagist 托管地址：

版权和许可
-----

[](#版权和许可)

[fast-api/permission](https://github.com/fast-oopdev/fast-api-permission)was written by [fast-php](http://www.dnat.link) and is released under the [MIT License](LICENSE.md).

Copyright (c) 2021 fast-php

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

1848d ago

Major Versions

v1.0.0 → v2.0.0.x-dev2021-04-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/815729f327c8fcabeca0a18a0c5b011a2253ce88832f9c864ec85621a7d53691?d=identicon)[fast-oopdev](/maintainers/fast-oopdev)

---

Top Contributors

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

---

Tags

laravelpermissionrbac

### Embed Badge

![Health badge](/badges/fast-api-permission/health.svg)

```
[![Health](https://phpackages.com/badges/fast-api-permission/health.svg)](https://phpackages.com/packages/fast-api-permission)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[efficiently/authority-controller

AuthorityController is an PHP authorization library for Laravel 5 which restricts what resources a given user is allowed to access.

15533.2k](/packages/efficiently-authority-controller)[orchestra/auth

Auth Component for Orchestra Platform

24108.5k3](/packages/orchestra-auth)[hosseinhezami/laravel-permission-manager

Advanced permission manager for Laravel.

403.3k](/packages/hosseinhezami-laravel-permission-manager)[wnikk/laravel-access-rules

Simple system of ACR (access control rules) for Laravel, with roles, groups, unlimited inheritance and possibility of multiplayer use.

103.6k1](/packages/wnikk-laravel-access-rules)

PHPackages © 2026

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