PHPackages                             orderonlineid/role-permission-laravel-mongodb - 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. [Database &amp; ORM](/categories/database)
4. /
5. orderonlineid/role-permission-laravel-mongodb

ActiveLibrary[Database &amp; ORM](/categories/database)

orderonlineid/role-permission-laravel-mongodb
=============================================

Permission handling for Laravel Mongodb

1.0.10(1y ago)26091MITPHPPHP 8.1|^8.0

Since Mar 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/orderonlineid/role-permission-laravel-mongodb)[ Packagist](https://packagist.org/packages/orderonlineid/role-permission-laravel-mongodb)[ RSS](/packages/orderonlineid-role-permission-laravel-mongodb/feed)WikiDiscussions main Synced 1mo ago

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

Role &amp; Permission for Laravel MongoDB
=========================================

[](#role--permission-for-laravel-mongodb)

This package provides role and permission management for Laravel applications using MongoDB as the database.

Installation
============

[](#installation)

To install this package, run the following Composer command:

```
composer require orderonlineid/role-permission-laravel-mongodb

```

After the installation is complete, you need to publish the configuration file and migrations by running the following command:

```
php artisan vendor:publish --provider="OrderOnlineId\RolePermissionMongoDb\RolePermissionMongoDbServiceProvider"

```

Usage
=====

[](#usage)

Setting Up Roles and Permissions To set up roles and permissions, you can use the Role and Permission models provided by this package.

```
use OrderOnlineId\RolePermissionMongoDb\Models\Role;
use OrderOnlineId\RolePermissionMongoDb\Models\Permission;

// Create a new role
$role = Role::create(['name' => 'admin']);

// Create a new permission
$permission = Permission::create(['code' => 'create','name' => 'Create']);

// Assign the permission to the role
$role->givePermissionTo($permission);

```

Assigning Roles and Permissions to Users
========================================

[](#assigning-roles-and-permissions-to-users)

To assign roles and permissions to users, you can use the HasRoles and HasPermissions traits provided by this package.

```
use App\Models\User;
use OrderOnlineId\RolePermissionMongoDb\Traits\HasRoles;
use OrderOnlineId\RolePermissionMongoDb\Traits\HasPermissions;

class User extends Authenticatable
{
    use HasRoles, HasPermissions;

    // ...
}

```

After that, you can assign roles and permissions to users like this:

```
$user = User::find(1);

$permission = Permission::create(['code' => 'create','name' => 'Create']);

// Assign a role
$user->assignRole($permission);

// Grant a permission
$user->givePermissionTo('view', 'users');

```

Checking User Roles and Permissions
===================================

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

You can check if a user has a specific role or permission like this:

```
$user = User::find(1);

// Check for a role
if ($user->hasRole('admin')) {
    // ...
}

// Check for a permission
if ($user->hasAllPermission('view', 'users')) {
    // ...
}

```

For more information on using this package, please refer to the documentation or the configuration file.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.5% 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 ~14 days

Recently: every ~1 days

Total

16

Last Release

574d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.0.9PHP 8.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/051742026159f0996278b5b7c96965c4d66d12dbd6a8b83ee89c70a1a1a075af?d=identicon)[orderonlineid](/maintainers/orderonlineid)

---

Top Contributors

[![dadansatriaoo](https://avatars.githubusercontent.com/u/163958746?v=4)](https://github.com/dadansatriaoo "dadansatriaoo (47 commits)")[![oorizky](https://avatars.githubusercontent.com/u/121288750?v=4)](https://github.com/oorizky "oorizky (9 commits)")[![dadansatria](https://avatars.githubusercontent.com/u/11630065?v=4)](https://github.com/dadansatria "dadansatria (1 commits)")

---

Tags

laravelsecurityaclpermissionmongodborderonline

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[mostafamaklad/laravel-permission-mongodb

Permission handling for Laravel 5.2 and up using mongodb

113220.0k2](/packages/mostafamaklad-laravel-permission-mongodb)[konekt/acl

Concord Module for Permission handling (Laravel 10 - 12)

1070.8k1](/packages/konekt-acl)[wnikk/laravel-access-rules

Simple system of ACR (access control rules) for Laravel, with roles, groups, unlimited inheritance and possibility of multiplayer use.

103.6k1](/packages/wnikk-laravel-access-rules)

PHPackages © 2026

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