PHPackages                             stingraydevelopment/roles-and-permissions - 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. stingraydevelopment/roles-and-permissions

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

stingraydevelopment/roles-and-permissions
=========================================

Adds Roles and Permissions to Laravel

012PHP

Since Dec 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/stingraydevelopment/Roles-Permissions)[ Packagist](https://packagist.org/packages/stingraydevelopment/roles-and-permissions)[ RSS](/packages/stingraydevelopment-roles-and-permissions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Roles and Permissions
=====================

[](#roles-and-permissions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/68d9e2d3d4b3e6d0b26ff49fe384d696cd5fc2f6991091e7b05d6a108d30ddeb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374696e67726179646576656c6f706d656e742f726f6c65732d616e642d7065726d697373696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stingraydevelopment/roles-and-permissions)[![Total Downloads](https://camo.githubusercontent.com/40a74522d0846d0f7c62944c8a58c48824a01830ecaa36bb6e43a1e7a186b860/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374696e67726179646576656c6f706d656e742f726f6c65732d616e642d7065726d697373696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stingraydevelopment/roles-and-permissions)[![GitHub Actions](https://github.com/stingraydevelopment/roles-and-permissions/actions/workflows/main.yml/badge.svg)](https://github.com/stingraydevelopment/roles-and-permissions/actions/workflows/main.yml/badge.svg)

This Roles &amp; Permissions by StingrayDevelopment helps add roles &amp; permissions capabilities along with the relationship between each other and the users.

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

[](#installation)

You can install the package via composer:

```
composer require stingraydevelopment/roles-and-permissions
```

### Publish

[](#publish)

Publish the package in your Laravel app using the following command.

```
php artisan vendor:publish
```

You will see something similiar to the following

```
Which provider or tags files would you like to publish?
  Publish files from all providers and tags listed below ......................................................................................... 0
  Provider: Illuminate\Foundation\Providers\FoundationServiceProvider ............................................................................ 1
  Provider: Illuminate\Mail\MailServiceProvider .................................................................................................. 2
  Provider: Illuminate\Notifications\NotificationServiceProvider ................................................................................. 3
  Provider: Illuminate\Pagination\PaginationServiceProvider ...................................................................................... 4
  Provider: Laravel\Sail\SailServiceProvider ..................................................................................................... 5
  Provider: Laravel\Sanctum\SanctumServiceProvider ............................................................................................... 6
  Provider: Laravel\Tinker\TinkerServiceProvider ................................................................................................. 7
  Provider: Stingraydevelopment\RolesAndPermissions\RolesAndPermissionsServiceProvider ........................................................... 8
```

Type the number next to Stingraydevelopment\\RolesAndPermissions\\RolesAndPermissionsServiceProvider and click Enter. This will copy all of the necessary files you need in order use and manage Roles &amp; Permissions easily within your Laravel app.

### Integrate

[](#integrate)

There are some additional steps needed to use Roles &amp; Permissions. Please follow the next few steps carefully.

#### User Class

[](#user-class)

Roles &amp; Permissions was built with a default Laravel installation we assume that the initial user model location remains the same. "App/Models/User.php"

Open your User.php and add the following functions.

```
    /**
     * Roles relationship.
     * Roles imported using the StingrayDevelopment\RolesAndPermissions package.
     *
     * @return Collection   Collection of Role objects.
     */
    public function roles()
    {
        return $this->belongsToMany(Role::class);
    }

    /**
     * Permissions relationship.
     * Permissions imported using the StingrayDevelopment\RolesAndPermissions package.
     *
     * @return Collection   Collection of Permission objects.
     */
    public function permissions()
    {
        return $this->belongsToMany(Permission::class);
    }
```

### Vue

[](#vue)

Usage
-----

[](#usage)

```
// Usage description here
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Dan Castanera](https://github.com/stingraydevelopment)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 78.6% 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/aaa2cb0a3f6d45e5b251f3dd1fadeace30200e58a593d1d2bd03765e15c58137?d=identicon)[stingraydevelopment](/maintainers/stingraydevelopment)

---

Top Contributors

[![castaneras](https://avatars.githubusercontent.com/u/107968171?v=4)](https://github.com/castaneras "castaneras (11 commits)")[![stingraydevelopment](https://avatars.githubusercontent.com/u/117549512?v=4)](https://github.com/stingraydevelopment "stingraydevelopment (3 commits)")

### Embed Badge

![Health badge](/badges/stingraydevelopment-roles-and-permissions/health.svg)

```
[![Health](https://phpackages.com/badges/stingraydevelopment-roles-and-permissions/health.svg)](https://phpackages.com/packages/stingraydevelopment-roles-and-permissions)
```

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