PHPackages                             sbennett/jukumu - 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. sbennett/jukumu

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

sbennett/jukumu
===============

Laravel 5 User Roles and Permissions Extension

06PHP

Since May 29Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Jukumu
======

[](#jukumu)

This package adds extra functionality to the built in User Authentication. This adds the ability to do User Roles and Permissions.

Features
--------

[](#features)

- Ability to add a role to a user and add permissions to that role.

Installing
----------

[](#installing)

You should install this package with [Composer](http://getcomposer.org/). Add the following `require` to your `composer.json` file and run the `composer install` command to install it.

### Laravel 5

[](#laravel-5)

```
{
    "require": {
        "sbennett/jukumu": "dev-master"
    }
}
```

Then in your `config/app.php` add this line to the `providers` array.

```
'SamBenne\Jukumu\Providers\JukumuServiceProvider',
```

Usage
-----

[](#usage)

To get the extra features into the User class you simply need to add inside the User class.

For example:

```
use Illuminate\Database\Eloquent\Model;
use SamBenne\Jukumu\Traits\JukumuRoleTrait;

class User extends Model
{
    use Authenticatable, CanResetPassword, JukumuRoleTrait;
}
```

Once this is in you can use these new methods are automatically made available, within the class:

- `setRole( $roleName )`
- `is( $roleName )`
- `hasRole( array $roleNames )`
- `has( array $permissions )`

There are also a helper class `Jukumu` that will help with creating the roles and permissions.

- `Jukumu::createRole( $name, $display_name = NULL, $description = NULL, $order = 0 )`
- `Jukumu::createPermission( $name, $group = NULL, $display_name = NULL, $description = NULL )`
- `Jukumu::attachRole( $user, Role $role, array $permissions = [] )`
- `Jukumu::attachPermissions( Role $role, array $permissions = [] )`

### Create Role

[](#create-role)

This will create a role. This only requires a name however, there are extra information that you can add.

- **Name**: Required, String
- **Display Name**: Optional, String
- **Description**: Optional, String
- **Order**: Optional, Integer

**Example**

```
Jukumu::createRole('admin', 'Admin', 'This is my main admin role.');
Jukumu::createRole('user', 'User', 'This is the basic user role.', 1);
```

### Create Permission

[](#create-permission)

This will create a permission that you can attach to a role later.

- **Name**: Required, String
- **Group**: Optional, String
- **Display Name**: Optional, String
- **Description**: Optional, String

The group parameter allows you to group the permissions together, this then allows for dot notation on permission checking later.

**Example**

```
Jukumu::createPermission('view', 'blog', 'View Blog Post', 'View the blog post.');
Jukumu::createPermission('edit', 'blog', 'Edit Blog Post', 'Edit the blog post.');
```

### Attaching

[](#attaching)

There are two methods of attaching the first `attachRole` allows you to attach a role to a user and the permissions to that role. The other just allows for attaching permissions to the role.

**Example 1**

This attaches a role and permissions to the user.

```
Jukumu::attachRole(Auth::user(), Role::find(1), ['blog.view', 'blog.edit']);
```

**Example 2**

This attaches the permissions straight to the role.

```
Jukumu::attachPermissions( Role::find(1), [
    'blog.view', 'blog.edit'
] );
```

Troubleshooting
---------------

[](#troubleshooting)

If an error has occurred please check and add an issue with the error in the issues.

License
-------

[](#license)

Jukumu is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.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/1b11df4c726c5573a3be925c223e0aa333efeab0fc0753d6cbe7a96f72db10f6?d=identicon)[sam\_benne](/maintainers/sam_benne)

---

Top Contributors

[![sambenne](https://avatars.githubusercontent.com/u/363734?v=4)](https://github.com/sambenne "sambenne (38 commits)")[![jbrooksuk](https://avatars.githubusercontent.com/u/246103?v=4)](https://github.com/jbrooksuk "jbrooksuk (8 commits)")

### Embed Badge

![Health badge](/badges/sbennett-jukumu/health.svg)

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

###  Alternatives

[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)[illuminate/auth

The Illuminate Auth package.

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

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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