Download the PHP package cuongnx/laravel-mongodb-permission without Composer
On this page you can find all versions of the php package cuongnx/laravel-mongodb-permission. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cuongnx/laravel-mongodb-permission
More information about cuongnx/laravel-mongodb-permission
Files in cuongnx/laravel-mongodb-permission
Package laravel-mongodb-permission
Short Description A flexible and multi-guard Role & Permission system for Laravel 11+ and 12+, using MongoDB and inspired by Spatie.
License MIT
Informations about the package laravel-mongodb-permission
MongoPermission โ Role & Permission for MongoDB in Laravel 11+
โ Supports Laravel 11 and 12+ with full MongoDB role/permission management.
MongoPermission is a library that extends Spatie's Role & Permission system to support MongoDB, with multi-guard support, easy-to-use syntax, and flexible expansion for Laravel applications.
๐งพ Version Information
Item | Requirement |
---|---|
Library Version | v1.0.0 * |
Supported Laravel Version | ^11.0 |
MongoDB Laravel Driver | mongodb/laravel-mongodb ^3.9 |
MongoDB PHP Extension | mongodb PHP extension >=1.13 |
MongoDB Server | >=4.0 |
PHP Version | >=8.0 |
๐ก Make sure to install MongoDB Laravel package:
โ Features
- Role and Permission support with MongoDB
- Multi-guard support:
web
,admin
, etc. - Middleware:
role
,permission
(supports multiple roles/permissions) - Extended Blade directives:
@role
,@permission
,@hasanyrole
,@hasallroles
- Powerful CLI command:
php artisan mp:manage
- Easily extendable UI or integration into admin systems
โ๏ธ Installation
๐ง MongoDB Configuration
.env
:
config/auth.php
:
๐งฉ Model Setup
๐ก Middleware Usage
- Middleware supports multiple roles/permissions:
๐จ Blade Directives
Guard can be passed explicitly:
@role('admin', 'admin')
๐ง CLI Usage
๐ฏ Available Options:
Option | Description | |
---|---|---|
--create-role= |
Create one or more roles | |
--delete-role= |
Delete one or more roles | |
--create-permission= |
Create one or more permissions | |
--delete-permission= |
Delete one or more permissions | |
--assign-permission= |
Assign permissions to a role. Format: `role\:permission1 | permission2` | |
--list-roles |
List all roles | |
--list-permissions |
List all permissions | |
--guard= |
Guard name (default: web ) |
|
--reset |
Remove all roles and permissions | |
--export=path/to/file.json |
Export all roles & permissions to a JSON file | |
--import=path/to/file.json |
Import from a JSON file | |
--sync-role-permissions= |
Sync permissions for role from JSON file (role:path.json ) |
|
--show-role=role |
View detailed information about a role |
๐ Example:
๐ฆ Export / Import JSON
๐ Library Structure
๐ Donate
If you find this package useful, feel free to support the development:
โ Coffee & Support
๐ฆ Bank (VIETQR)
- Account Holder: NGUYEN XUAN CUONG
- Account Number:
1368686856
- Bank: Techcombank
๐ฌ Contact
- Email: [email protected]
๐ชช License
MIT License ยฉ Cuong Nguyen
All versions of laravel-mongodb-permission with dependencies
laravel/framework Version ^11.0 || ^11.0 || ^12.0
mongodb/laravel-mongodb Version ^5.4