Download the PHP package bhhaskin/laravel-roles-permissions without Composer

On this page you can find all versions of the php package bhhaskin/laravel-roles-permissions. 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 laravel-roles-permissions

Laravel Roles & Permissions

Tests

Roles and permissions management for Laravel applications.

Installation

Optionally publish the configuration and migration stubs:

Run the migrations:

Setup

Apply the trait to any authenticatable model that should handle roles and permissions:

By default the package ships with Role and Permission Eloquent models. You can swap these (and the underlying table names) by publishing the config file.

Usage

Roles automatically inherit all attached permissions, so hasPermission will return true when a user has a role that grants the ability.

Roles and permissions include a generated uuid column, and the default route key is switched to use it so API responses can safely expose the identifier without leaking incremental IDs.

Laravel's class-based factory discovery is supported out of the box; pull in the package and you can call Role::factory() or Permission::factory() from your tests or seeders. A convenience database seeder (Bhhaskin\RolesPermissions\Database\Seeders\RolesPermissionsSeeder) is also provided—run it with php artisan db:seed --class="Bhhaskin\RolesPermissions\Database\Seeders\RolesPermissionsSeeder" to quickly populate sample data. If you prefer to customize them, publish the assets:

Configuration

Publish the config to tweak model classes, table names, or caching preferences. The cache section is reserved for future enhancements; for now it stays disabled by default.

Enable object-level assignments by setting object_permissions.enabled to true in the published config. When enabled you can scope roles and permissions to individual models:

If you need different role catalogs for different models (for example teams vs organizations) define role_scopes in the config:

Roles created with a matching scope value (or created through Role::factory()->forScope('team')) can then only be assigned when that context model is supplied, while standalone roles continue to work globally. You can query the catalog by scope using the provided helpers:

Scoped permission creation

Scoped permissions work the same way as scoped roles. You can generate them via the factories and attach them to matching roles:

To list abilities for a given tenant type you can chain the helpers:


All versions of laravel-roles-permissions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/auth Version ^10.0 || ^11.0
illuminate/database Version ^10.0 || ^11.0
illuminate/support Version ^10.0 || ^11.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 bhhaskin/laravel-roles-permissions contains the following files

Loading the files please wait ...