PHPackages                             creativecrafts/laravel-role-permission-manager - 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. creativecrafts/laravel-role-permission-manager

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

creativecrafts/laravel-role-permission-manager
==============================================

A simple package to manager an application role and permissions.

1.0.2(1y ago)148[5 PRs](https://github.com/CreativeCrafts/laravel-role-permission-manager/pulls)MITPHPPHP ^8.3|^8.2CI passing

Since Jan 17Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/CreativeCrafts/laravel-role-permission-manager)[ Packagist](https://packagist.org/packages/creativecrafts/laravel-role-permission-manager)[ Docs](https://github.com/CreativeCrafts/laravel-role-permission-manager)[ GitHub Sponsors](https://github.com/CreativeCrafts)[ RSS](/packages/creativecrafts-laravel-role-permission-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (9)Used By (0)

Laravel Role Permission Manager
===============================

[](#laravel-role-permission-manager)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c689224cef69f0b4e841ce6f018e16809dcf1988442f1b8f0d0349cf5fec3a6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63726561746976656372616674732f6c61726176656c2d726f6c652d7065726d697373696f6e2d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/creativecrafts/laravel-role-permission-manager)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c3cab34799e89584c438191a1d4ceb2f52cbb1e059fee6c20e1dbc6cd123e57b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63726561746976656372616674732f6c61726176656c2d726f6c652d7065726d697373696f6e2d6d616e616765722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/creativecrafts/laravel-role-permission-manager/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1d02bf572d838676b6d116bfb16f7724791039b696c80ce28499338972d1e981/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63726561746976656372616674732f6c61726176656c2d726f6c652d7065726d697373696f6e2d6d616e616765722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/creativecrafts/laravel-role-permission-manager/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/fb69c19faa7e9d7159eb64972c59a5316d804819f4f4b51d315674005575fb39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63726561746976656372616674732f6c61726176656c2d726f6c652d7065726d697373696f6e2d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/creativecrafts/laravel-role-permission-manager)

Laravel Role Permission Manager is a powerful yet simple package designed to streamline the management of roles and permissions in Laravel applications. It provides an intuitive interface for creating, assigning, and managing user roles and their associated permissions, allowing developers to implement complex authorization systems with ease.

This package is perfect for applications of all sizes, from small projects to large-scale enterprise systems, offering flexibility and scalability in handling user access control. Whether you're building a simple blog with admin roles or a complex multi-tenant application with granular permissions, Laravel Role Permission Manager has got you covered.

Features
--------

[](#features)

- Easy integration with Laravel's authentication system
- Flexible role and permission management
- Middleware for protecting routes based on roles and permissions
- Blade directives for easy view-level access control
- Easily extendable and customizable
- Comprehensive testing suite ensuring reliability
- Clear and concise API for programmatic access control

Table of Contents
-----------------

[](#table-of-contents)

1. [Getting Started](#getting-started)
    - [Installation](#installation)
    - [Configuration](#configuration)
    - [Database Migrations](#database-migrations)
2. [Usage](#usage)
    - [Models](#models)
        - [Permission Model](#permission-model)
        - [Role Model](#role-model)
    - [Middleware](#middleware)
        - [HandleInertiaRequests Middleware](#handleinertiarequests-middleware)
            - [Key Features](#key-features)
            - [How it Works](#how-it-works)
            - [Usage](#usage)
            - [Accessing Permissions in the Frontend](#accessing-permissions-in-the-frontend)
        - [PermissionMiddleware](#permissionmiddleware)
            - [Key Features](#key-features)
            - [Usage](#usage)
            - [Multiple Permissions](#multiple-permissions)
            - [Handling Unauthorized Access](#handling-unauthorized-access)
        - [RoleMiddleware](#rolemiddleware)
            - [Key Features](#key-features-1)
            - [Usage](#usage-1)
            - [Multiple Roles](#multiple-roles)
            - [Handling Unauthorized Access](#handling-unauthorized-access-1)
    - [Facade](#facade)
    - [Artisan Commands](#artisan-commands)
    - [Automatic Route Registration](#automatic-route-registration)
        - [Customizing Route Registration](#customizing-route-registration)
3. [Authorization Policies](#authorization-policies)
    - [Policy Registration](#policy-registration)
    - [Using the Policies](#using-the-policies)
        - [Available Policy Methods](#available-policy-methods)
        - [Custom Policies](#custom-policies)
4. [Frontend Integration](#frontend-integration)
    - [Accessing Permissions in the Frontend](#accessing-permissions-in-the-frontend)
    - [Vue Permission Helper Functions](#vue-permission-helper-functions)
        - [Key Functions](#key-functions)
        - [Usage in Vue Components](#usage-in-vue-components)
        - [Note on Permissions Data](#note-on-permissions-data)
    - [React Permission Hooks](#react-permission-hooks)
        - [Key Features](#key-features)
        - [Usage](#usage-2)
        - [Available Functions](#available-functions)
        - [Note on Permissions Data](#note-on-permissions-data-1)
5. [Contributing](#contributing)
6. [Security](#Security-Vulnerabilities)
7. [Credits](#credits)
8. [License](#license)

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

1. Install the package via Composer:

```
composer require creativecrafts/laravel-role-permission-manager
```

2. Publish and run the migrations:

```
php artisan vendor:publish --tag="role-permission-manager-migrations"
php artisan migrate
```

3. Optionally, publish the config file:

```
php artisan vendor:publish --tag="role-permission-manager-config"
```

Publishing TypeScript Files
---------------------------

[](#publishing-typescript-files)

To use the TypeScript helper files in your application, you can publish them using the following command:

```
php artisan vendor:publish --tag="laravel-role-permission-manager-typescript"
```

### Configuration

[](#configuration)

Customize the package behavior by editing the published config file config/role-permission-manager.php.

Key configuration options:

```
- user_model: Specify the User model used by your application
- roles_table: Define the name for the roles table
- permissions_table: Define the name for the permissions table
- cache_expiration_time: Set the cache expiration time for roles and permissions
- default_guard: Specify the default guard for role and permission checks
- use_package_routes: If set to true, the package will register its routes automatically.
- route_middleware: Define the middleware to be applied to the package routes
- route_prefix: Set the prefix for the package routes
- super_admin_role: Define the role that should be considered as a super admin
- auto_create_permissions: Enable or disable automatic creation of permissions
- enable_wildcard_permission: Enable or disable wildcard permissions
- case_sensitive_permissions: Choose whether permission names should be case-sensitive

```

### Registering Your User Model

[](#registering-your-user-model)

After installing the package, you need to register your User model. This step is crucial for the package to work correctly with your application's user model.

Add the following code to your `AppServiceProvider` or a custom service provider:

```
use CreativeCrafts\LaravelRolePermissionManager\LaravelRolePermissionManagerServiceProvider;

public function boot()
{
    LaravelRolePermissionManagerServiceProvider::registerUserModel(\App\Models\User::class);
}
```

### Database Migrations

[](#database-migrations)

The package includes migrations for creating the necessary database tables. These will be published when you run the vendor publish command for migrations.

Usage
-----

[](#usage)

### Models

[](#models)

#### Permission Model

[](#permission-model)

The Permission model represents individual permissions in your application.

Key features:

- Automatic slug generation
- Wildcard permissions support
- Scope support

Usage example:

```
use CreativeCrafts\LaravelRolePermissionManager\Models\Permission;

$permission = Permission::create([
    'name' => 'Edit Posts',
    'description' => 'Allow user to edit posts',
    'scope' => 'blog'
]);
```

#### Role Model

[](#role-model)

The Role model represents roles that can be assigned to users and associated with permissions.

Key features:

- Automatic slug generation
- Role hierarchy support
- Permission checking methods

Usage example:

```
use CreativeCrafts\LaravelRolePermissionManager\Models\Role;

$role = Role::create([
    'name' => 'Editor',
    'description' => 'Can edit and publish content'
]);

if ($role->hasPermissionTo('edit-posts')) {
    // Allow editing posts
}
```

### Middleware

[](#middleware)

#### HandleInertiaRequests Middleware

[](#handleinertiarequests-middleware)

The `HandleInertiaRequests` middleware is designed to work with Inertia.js applications, sharing the authenticated user's permissions with the frontend.

#### Key Features

[](#key-features)

1. **Inertia Request Detection**: Automatically detects if the current request is an Inertia request.
2. **Permission Sharing**: Shares the authenticated user's permissions with Inertia, making them available on the frontend.
3. **Caching**: Uses Laravel's cache system to store user permissions, improving performance by reducing database queries.

#### How it Works

[](#how-it-works)

1. The middleware checks if the request is an Inertia request.
2. If it is, it retrieves the authenticated user's permissions.
3. These permissions are then shared with Inertia, making them available in the frontend as `auth.permissions`.

#### Usage

[](#usage-1)

To use this middleware, add it to your `app/Http/Kernel.php` file in the `web` middleware group:

```
protected $middlewareGroups = [
    'web' => [
        // ... other middleware
        \CreativeCrafts\LaravelRolePermissionManager\Middleware\HandleInertiaRequests::class,
    ],
];
```

Once added, the middleware will automatically share the authenticated user's permissions with your Inertia frontend.

#### Accessing Permissions in the Frontend

[](#accessing-permissions-in-the-frontend)

Example: In your Vue components, you can access the user's permissions like this:

```
const permissions = this.$page.props.auth.permissions;

// Check if user has a specific permission
if (permissions.includes('edit-posts')) {
    // User can edit posts
}
```

This middleware enhances the integration between your Laravel backend and Inertia.js frontend, making it easier to implement permission-based UI logic.

#### PermissionMiddleware

[](#permissionmiddleware)

The `PermissionMiddleware` is designed to protect routes based on user permissions. It checks if the authenticated user has the required permission(s) before allowing access to a route.

#### Key Features

[](#key-features-1)

1. **Route Protection**: Allows you to specify required permissions for accessing specific routes.
2. **Multiple Permission Support**: Can check for multiple permissions, granting access if the user has any of them.
3. **Authentication Check**: Ensures the user is authenticated before checking permissions.
4. **JSON Response Support**: Returns a JSON response for unauthorized actions if the request expects JSON.

#### Usage

[](#usage-2)

To use this middleware, you can add it to your routes or controllers:

1. In your `app/Http/Kernel.php`, add an alias for the middleware:

```
protected $routeMiddleware = [
    // ... other middleware
    'permission' => \CreativeCrafts\LaravelRolePermissionManager\Middleware\PermissionMiddleware::class,
];
```

2. Use it in your routes:

```
Route::get('/admin/posts', [PostController::class, 'index'])->middleware('permission:view-posts');
```

3. Or use it in your controllers:

```
public function __construct()
{
    $this->middleware('permission:edit-posts')->only('edit', 'update');
}
```

#### Multiple Permissions

[](#multiple-permissions)

You can specify multiple permissions. The middleware will allow access if the user has any of the specified permissions:

```
Route::get('/admin/users', [UserController::class, 'index'])->middleware('permission:view-users,manage-users');
```

#### Handling Unauthorized Access

[](#handling-unauthorized-access)

When a user doesn't have the required permission:

- For regular requests, it will abort with a 403 status and "Unauthorized action." message.
- For JSON requests, it will return a JSON response with a 403 status and an "Unauthorized action." message. This middleware provides a robust way to implement permission-based access control in your Laravel application, integrating seamlessly with the Laravel Role Permission Manager package.

#### RoleMiddleware

[](#rolemiddleware)

The `RoleMiddleware` is designed to protect routes based on user roles. It checks if the authenticated user has the required role(s) before allowing access to a route.

#### Key Features

[](#key-features-2)

1. **Route Protection**: Allows you to specify required roles for accessing specific routes.
2. **Multiple Role Support**: Can check for multiple roles, granting access if the user has any of them.
3. **Authentication Check**: Ensures the user is authenticated before checking roles.
4. **JSON Response Support**: Returns a JSON response for unauthorized actions if the request expects JSON.

#### Usage

[](#usage-3)

To use this middleware, you can add it to your routes or controllers:

1. In your `app/Http/Kernel.php`, add an alias for the middleware:

```
protected $routeMiddleware = [
    // ... other middleware
    'role' => \CreativeCrafts\LaravelRolePermissionManager\Middleware\RoleMiddleware::class,
];
```

2. Use it in your routes:

```
Route::get('/admin', [AdminController::class, 'index'])->middleware('role:admin');
```

3. Or use it in your controllers:

```
public function __construct()
{
    $this->middleware('role:editor')->only('create', 'store');
}
```

#### Multiple Roles

[](#multiple-roles)

You can specify multiple roles. The middleware will allow access if the user has any of the specified roles:

```
Route::get('/dashboard', [DashboardController::class, 'index'])->middleware('role:admin,manager');
```

#### Handling Unauthorized Access

[](#handling-unauthorized-access-1)

When a user doesn't have the required role:

- For regular requests, it will abort with a 403 status and "Unauthorized action." message.
- For JSON requests, it will return a JSON response with a 403 status and an "Unauthorized action." message. This middleware provides a straightforward way to implement role-based access control in your Laravel application, complementing the permission-based middleware and integrating seamlessly with the Laravel Role Permission Manager package.

### Facade

[](#facade)

The package provides a facade for easy access to role and permission management functions.

#### Key methods:

[](#key-methods)

- `createRole(string $name, string $slug, ?string $description = null, ?Role $parent = null): Role`
- `createPermission(string $name, string $slug, ?string $description = null): Permission`
- `givePermissionToRole(Role $role, Permission|string $permission, ?string $scope = null): void`
- `revokePermissionFromRole(Role $role, Permission|string $permission, ?string $scope = null): void`
- `syncPermissions(Role $role, array $permissions): void`
- `hasPermissionTo(mixed $user, string $permission, ?string $scope = null): bool`
- `getSubRoles(Role $role): Collection`
- `grantPermissionToRoleAndSubRoles(Role $role, Permission|string $permission): void`
- `revokePermissionFromRoleAndSubRoles(Role $role, Permission|string $permission): void`

Usage example:

```
use CreativeCrafts\LaravelRolePermissionManager\Facades\LaravelRolePermissionManager;

// Create a role
$role = LaravelRolePermissionManager::createRole('Editor', 'editor');

// Create a permission
$permission = LaravelRolePermissionManager::createPermission('Edit Posts', 'edit-posts');

// Give permission to role
LaravelRolePermissionManager::givePermissionToRole($role, $permission);

// Grant permission to role and its sub-roles
LaravelRolePermissionManager::grantPermissionToRoleAndSubRoles($role, 'edit-posts');

// Revoke permission from role and its sub-roles
LaravelRolePermissionManager::revokePermissionFromRoleAndSubRoles($role, 'edit-posts');

// Check if user has permission
$hasPermission = LaravelRolePermissionManager::hasPermissionTo($user, 'edit-posts');

// Get all sub-roles of a given role
$parentRole = Role::findByName('manager');
$subRoles = LaravelRolePermissionManager::getSubRoles($parentRole);

// Grant a permission to a role and all its sub-roles
$role = Role::findByName('manager');
LaravelRolePermissionManager::grantPermissionToRoleAndSubRoles($role, 'edit_posts');

// Revoke a permission from a role and all its sub-roles
LaravelRolePermissionManager::revokePermissionFromRoleAndSubRoles($role, 'delete_users');
```

These new methods allow for more granular control over role hierarchies and permissions. The getSubRoles method retrieves all sub-roles of a given role, while grantPermissionToRoleAndSubRoles and revokePermissionFromRoleAndSubRoles apply permission changes to both the specified role and all its sub-roles.

### Artisan Commands

[](#artisan-commands)

The package provides several Artisan commands to manage roles and permissions:

```
- create:role: Create a new role
- create:permission: Create a new permission
- assign:permission: Assign a permission to a role
- remove:permission: Remove a permission from a role
- list:roles-permissions: List all roles and permissions
- sync:permissions: Synchronize permissions for a role

```

#### Automatic Route Registration

[](#automatic-route-registration)

By default, the package registers the following routes:

- `GET /roles`: List all roles
- `GET /permissions`: List all permissions
- `GET /user/{userId}/roles`: Get roles for a specific user
- `GET /user/{userId}/permissions`: Get permissions for a specific user
- `GET /user/{userId}/permissions/{scope}`: Get scoped permissions for a specific user

These routes are protected by middleware and can be accessed via the `RolePermissionController` included with the package.

#### Customizing Route Registration

[](#customizing-route-registration)

You can customize the route registration by setting the `use_package_routes` configuration option to false. it is set to true by default.

```
'use_package_routes' => false,
'route_prefix' => 'api',
'route_middleware' => ['api'],
```

Authorization Policies
----------------------

[](#authorization-policies)

The Laravel Role Permission Manager package comes with pre-defined authorization policies for the Role and Permission models. These policies are automatically registered when you use the package.

### Policy Registration

[](#policy-registration)

The policies are registered in the `AuthServiceProvider` that comes with the package:

```
use CreativeCrafts\LaravelRolePermissionManager\Models\Permission;
use CreativeCrafts\LaravelRolePermissionManager\Models\Role;
use CreativeCrafts\LaravelRolePermissionManager\Policies\PermissionPolicy;
use CreativeCrafts\LaravelRolePermissionManager\Policies\RolePolicy;

class AuthServiceProvider extends ServiceProvider
{
    protected $policies = [
        Role::class => RolePolicy::class,
        Permission::class => PermissionPolicy::class,
    ];

    public function boot(): void
    {
        $this->registerPolicies();
    }
}
```

### Using the Policies

[](#using-the-policies)

These policies allow you to control who can perform various actions on roles and permissions. You can use them in your controllers or other parts of your application like this:

```
// In a controller
public function update(Role $role)
{
    $this->authorize('update', $role);

    // Update logic here...
}
```

Or in a Blade template:

```
@can('update', $role)

@endcan
```

### Custom Policies

[](#custom-policies)

If you need to customize these policies, you can publish them to your application:

```
php artisan vendor:publish --tag="laravel-role-permission-manager-policies"
```

This will copy the policies to your app/Policies directory, where you can modify them as needed.

#### Available Policy Methods

[](#available-policy-methods)

Both the RolePolicy and PermissionPolicy typically include methods for standard CRUD operations:

```
- viewAny: Determine whether the user can view any roles/permissions.
- view: Determine whether the user can view the role/permission.
- create: Determine whether the user can create roles/permissions.
- update: Determine whether the user can update the role/permission.
- delete: Determine whether the user can delete the role/permission.

```

Remember to adjust your application's authorization logic in these policies according to your specific requirements.

Frontend Integration
--------------------

[](#frontend-integration)

### Accessing Permissions in the Frontend

[](#accessing-permissions-in-the-frontend-1)

Permissions are shared with the Inertia.js frontend and can be accessed in Vue components.

### Vue Permission Helper Functions

[](#vue-permission-helper-functions)

The package includes TypeScript-friendly utility functions for managing user permissions in Vue components.

#### Key Functions

[](#key-functions)

1. `can(permission: string, scope: string | null = null): boolean`

    - Checks if the user has a specific permission, optionally within a given scope.
2. `getScopedPermissions(scope: string): Permission[]`

    - Retrieves all permissions for a specific scope.
3. `hasAnyPermissionInScope(scope: string): boolean`

    - Checks if the user has any permission in a given scope.
4. `hasAllPermissions(permissionSlugs: string[]): boolean`

    - Checks if the user has all specified permissions.
5. `hasAnyPermission(permissionSlugs: string[]): boolean`

    - Checks if the user has any of the specified permissions.
6. `getAllScopes(): string[]`

    - Retrieves all unique scopes from the user's permissions.

#### Usage in Vue Components

[](#usage-in-vue-components)

To use these helpers in your Vue components:

1. Import the helper functions:

```
import {can, hasAnyPermission} from '@/path/to/permissions';
```

2. Use them in your component:

```

import { defineComponent } from 'vue';
import { can, hasAnyPermission } from '@/path/to/permissions';

export default defineComponent({
  setup() {
    return {
      can,
      hasAnyPermission,
    };
  },
});

```

#### Note on Permissions Data

[](#note-on-permissions-data)

These helpers expect the permissions data to be available on window.Laravel.permissions. Ensure this data is properly populated on your frontend, typically by sharing it through your backend views or API responses.

This TypeScript module provides a robust and type-safe way to manage permissions in your Vue.js frontend, complementing the backend permission management provided by the Laravel Role Permission Manager package.

### React Permission Hooks

[](#react-permission-hooks)

For React applications, the package provides a custom hook usePermissions.

#### Key Features

[](#key-features-3)

1. **Inertia.js Integration**: Works seamlessly with Inertia.js to access shared permissions data.
2. **Memoized Functions**: All permission checks are memoized for improved performance.
3. **Scoped Permissions**: Supports checking permissions within specific scopes.

#### Usage

[](#usage-4)

To use the `usePermissions` hook in your React components:

1. Import the hook:

```
import {usePermissions} from '@/path/to/usePermissions';
```

2. Use it in your component:

```
import React from 'react';
import {usePermissions} from '@/path/to/usePermissions';

const MyComponent: React.FC = () => {
    const {can, hasAnyPermission, hasAllPermissions} = usePermissions();

    return (

            {can('edit-posts') && Edit Post}
            {hasAnyPermission(['manage-users', 'view-users']) && }
            {hasAllPermissions(['create-post', 'publish-post']) && }

    );
};
```

#### Available Functions

[](#available-functions)

```
- can(permission: string, scope?: string): boolean
    Checks if the user has a specific permission, optionally within a given scope.
- hasAnyPermission(permissions: string[]): boolean
    Checks if the user has any of the specified permissions.
- hasAllPermissions(permissions: string[]): boolean
    Checks if the user has all of the specified permissions.
- getScopedPermissions(scope: string): Permission[]
    Retrieves all permissions for a specific scope.
- hasAnyPermissionInScope(scope: string): boolean
    Checks if the user has any permission in a given scope.

```

### Note on Permissions Data

[](#note-on-permissions-data-1)

This hook expects the permissions data to be available in the Inertia page props under auth.permissions. Ensure this data is properly shared from your Laravel backend when using Inertia.js.

This React hook provides a convenient and type-safe way to manage permissions in your React frontend when using Inertia.js, complementing the Laravel Role Permission Manager package's backend functionality.

Testing
-------

[](#testing)

To run the tests, use:

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

```
- [Godspower Oduose](https://github.com/rockblings)
- [All Contributors](../../contributors)

```

License
-------

[](#license)

The MIT License (MIT). Please see License File for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance71

Regular maintenance activity

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.8% 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 ~23 days

Total

3

Last Release

436d ago

PHP version history (2 changes)1.0.0PHP ^8.2

1.0.2PHP ^8.3|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b5e5ba42a2029e0f2fa45bd8d874c98599af2d2a1e77bff012ea07eeb0b65bc?d=identicon)[rockblings](/maintainers/rockblings)

---

Top Contributors

[![rockblings](https://avatars.githubusercontent.com/u/5190259?v=4)](https://github.com/rockblings "rockblings (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

laravelcreativeCraftslaravel-role-permission-manager

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/creativecrafts-laravel-role-permission-manager/health.svg)

```
[![Health](https://phpackages.com/badges/creativecrafts-laravel-role-permission-manager/health.svg)](https://phpackages.com/packages/creativecrafts-laravel-role-permission-manager)
```

###  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)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[spatie/laravel-login-link

Quickly login to your local environment

4381.2M1](/packages/spatie-laravel-login-link)[ryangjchandler/laravel-cloudflare-turnstile

A simple package to help integrate Cloudflare Turnstile.

438896.6k2](/packages/ryangjchandler-laravel-cloudflare-turnstile)[spatie/laravel-passkeys

Use passkeys in your Laravel app

444494.4k16](/packages/spatie-laravel-passkeys)

PHPackages © 2026

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