Download the PHP package xetreon/role-permission without Composer

On this page you can find all versions of the php package xetreon/role-permission. 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-permission

Xetreon Role Permission for Laravel

A lightweight and flexible role and permission management package for Laravel. It allows you to manage roles, assign permissions, and automatically generate permissions from your controllers. Supports super admin bypass and custom authentication drivers.


☕ Support Me

If you find this package helpful, consider supporting my work:

Buy Me a Coffee

Installation

Install via Composer:

Laravel 12 Integration

  1. Add the Service Provider

For Laravel 12 (add in bootstrap/providers.php):

For older Laravel versions (add in config/app.php):

  1. Add the Service Provider

  2. Add the Service Provider

Configuration

The configuration file role-permission.php contains the following options:

Explanation of Key Options:

Usage

  1. Add Trait to User Model

Artisan Commands

  1. Generate All Permissions

Scans the configured controller directory and Generates permissions for all controller methods (index, create, update, destroy by default). This also Skips controllers listed in exclude.

  1. Seed Super Admin Role

Seeds the Super Admin role in your database and assign a user as Super Admin by providing their ID. Automatically bypasses all permission checks if is true.

Methods

– Assigns a role to a user.

– Removes all roles from a user.

– Returns all roles of the user.

– Returns the first assigned role.

Query scopes

– Filter users by role code.

– Filter users by role ID.

Check Permissions in Controllers

Add this to any controller to check user permissions:

Allowed Methods in controller

– Checks if the authenticated user has permission for the method.

Core Authentication Drivers

– Default driver using your Auth::getAuth() method.

– Uses Laravel's built-in Auth::user().

You can create a custom driver by implementing a getAuth() method that returns a User instance. and you can update the newly created driver in auth_driver field in the config.php

Migrations

The package provides migrations for:

Logging

Both commands (xetreon:permissions and xetreon:seedRole) log actions using Laravel's default logging system (Log::info()).

Exception Handling

By default, permission failure return false. If is false, checkRole() simply returns false. If you want to throws the exception defined in permission_exception config, set as true

Notes

Example Workflow

License

MIT License


All versions of role-permission with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 xetreon/role-permission contains the following files

Loading the files please wait ...