PHPackages                             lewis15520/lararoles - 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. lewis15520/lararoles

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

lewis15520/lararoles
====================

A roles and permissions system for laravel

1.0.4(1y ago)0961mitPHP

Since Nov 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Lewis15520/Lararoles)[ Packagist](https://packagist.org/packages/lewis15520/lararoles)[ RSS](/packages/lewis15520-lararoles/feed)WikiDiscussions master Synced yesterday

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

Lararoles - Work In Progress
============================

[](#lararoles---work-in-progress)

A package to add roles and permissions to laravel

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

[](#requirements)

- PHP 7.3 or later
- Laravel 8 or later

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

[](#installation)

In order to run Lararoles you are required to follow these steps in your terminal

1. Install the package with `composer require lewis15520/lararoles`
2. Copy the required package conents with `php artisan vendor:publish --provider="Lewis15520\Lararoles\app\Providers\LararolesServiceProvider"`
3. Install the package migrations with `php artisan migrate`

Usage
-----

[](#usage)

### Adding the trait

[](#adding-the-trait)

In your `User` model, add the following lines in the `use` cases: `use Lewis15520\Lararoles\Traits;`. Then, inside the class, above the functions, add the following: `use Lararoles;`

### Checking the roles and permissions

[](#checking-the-roles-and-permissions)

Anywhere around the application where you have a user object (including from the `auth()->user()` helper), you can add attach a series of functions to check roles and permissions.

- hasRole: Usage "`$user->hasRole('roleName');`" | Definition "This will check for a singular role attached to this user."
- hasRoles: Usage "`$user->hasRoles(['role1Name', 'role2Name'], (optional) $requireAll = false);`" | Definition "This will check if atleast one of the roles given is attached to the user, unless the `$requireAll` variable is set to `true`, then it will only pass if all the roles are attached to the user."
- hasPermission: Usage "`$user->hasPermission('permissionName');`" | Definition "This will check for a singular permission attached to this user through their attached roles."
- hasPermissions: Usage "`$user->hasPermissions(['permission1Name', 'permission2Name'], (optional) $requireAll = false);`" | Definition "This will check if atleast one of the permissions given is attached to one of the roles that the user is assigned to, unless the `$requireAll` variable is set to `true`, then it will only pass if all the permissions are associated."

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

4

Last Release

721d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24722157?v=4)[Lewis Hayter](/maintainers/Lewis15520)[@Lewis15520](https://github.com/Lewis15520)

---

Top Contributors

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

---

Tags

laravellaravel-packageroles-permission-management

### Embed Badge

![Health badge](/badges/lewis15520-lararoles/health.svg)

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[santigarcor/laratrust

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

2.3k5.4M43](/packages/santigarcor-laratrust)[overtrue/laravel-follow

User follow unfollow system for Laravel.

1.2k404.7k5](/packages/overtrue-laravel-follow)[codegreencreative/laravel-samlidp

Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).

263763.5k1](/packages/codegreencreative-laravel-samlidp)

PHPackages © 2026

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