PHPackages                             lipeng93/authority - 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. lipeng93/authority

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

lipeng93/authority
==================

A privilege control program for Laravel

03PHP

Since Jul 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lipeng93/lipeng93-authority)[ Packagist](https://packagist.org/packages/lipeng93/authority)[ RSS](/packages/lipeng93-authority/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.0.0
- Laravel &gt;= 5.5.0

Installation
------------

[](#installation)

> This package requires PHP 7+ and Laravel 5.5

First, install laravel 5.5, and make sure that the database connection settings are correct.

```
composer require lipeng93/authority

```

Then run these commands to publish assets and config：

```
php artisan vendor:publish --tag=lipeng93-authority
```

After run command you can find config file in `config/authority.php`, in this file you can change the install directory,db connection or table names.

Set your login user model and primary key , then this model must to extends Lipeng93\\Authority\\UserModel

At last run php artisan migrate to finish install.

```
php artisan migrate

```

1. create role

    ```
    Authority::role()->add('admin','超级管理员')

    ```
2. create permission

    ```
    Authority::permission()->add('角色权限列表','role.permissions.index');

    ```
3. role sync permission

    ```
    public function syncPermissions(RoleModel $role)
    {
        return Authority::role()->syncPermissions($role,[1,2,3,4,5,6,7,8,9,10,11,12]);
    }

    ```
4. sync user role

    ```
    public function syncUserRoles(User $user,RoleModel $role)
    {
        return $user->role()->sync([$role->id]);
    }

    ```
5. verify user authority

    ```
    public function verifyUserAuthority(User $user)
    {
        return $user->verifyAuthority('route_name');
    }

    ```
6. users all permission

    ```
    $user->permission();

    ```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a44c4e6a9d02aaf5fcef2661740595b5352d7aac41d6979042cfa9181498a062?d=identicon)[lipeng93](/maintainers/lipeng93)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/lipeng93-authority/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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