Download the PHP package mimaxuz/role-manager without Composer

On this page you can find all versions of the php package mimaxuz/role-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package role-manager

Simple Role Manager

An easy and flexible Laravel authorization and roles permission management.

Total Downloads License

About

In many projects, you have to work with roles and permissions. Many packages are large and not all features are needed. That's why I tried to create a small but effective package for projects. This package can be attached to any project. Convenient and efficient. It is very easy to use and can be used after installation.

Requirements

Installation

Step 1: Install via Composer

Step 2: Run Migrations

Step 3: Publish Configuration (Optional)

This will create a config/role-manager.php file where you can customize default roles, permissions, and other settings.

Step 4: Add Trait to User Model

Open your App\Models\User model and add the HasPermissions trait:

Database Structure

This package creates the following tables with cascade relationships:

Database Diagram

Table Description
x_roles Stores role definitions (name, slug)
x_permissions Stores permission definitions (name, slug)
roles_permissions Pivot table linking roles to permissions
users_roles Pivot table linking users to roles

Artisan Commands

Role Management

Permission Management

Attach Permissions to Roles

Seed Default Roles & Permissions

Configuration

After publishing the config file, you can customize:

Usage

Programmatic Usage

Creating Roles & Permissions

Assigning Roles to Users

Checking Roles & Permissions

Route Middleware

Protect routes using the role middleware:

Blade Directives

@role / @endrole

@hasPermission / @endhasPermission

@hasAnyRole / @endhasAnyRole

Using Laravel's @can

Quick Start Example

Available Trait Methods

Method Description
hasRole(...$roles) Check if user has any of the given roles
hasPermissionTo($permission) Check if user has a specific permission
givePermissionsTo(...$permissions) Assign direct permissions to user
withdrawPermissionsTo(...$permissions) Remove permissions from user
refreshPermissions(...$permissions) Replace all user permissions
roles() Get user's roles relationship

Changelog

v2.0.0

v1.x

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you discover any issues or bugs, please report them at GitHub Issues.

License

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


All versions of role-manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mimaxuz/role-manager contains the following files

Loading the files please wait ...