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(2y ago)0961mitPHP

Since Nov 17Pushed 2y ago1 watchersCompare

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

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

27

—

LowBetter than 47% of packages

Maintenance20

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

775d 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

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.9k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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