Download the PHP package binary-cats/laravel-rbac without Composer

On this page you can find all versions of the php package binary-cats/laravel-rbac. 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-rbac

Laravel RBAC

Latest Version on Packagist run-tests GitHub Code Style Action Status

Enhance Laravel 11 with opinionated extension for spatie/laravel-permissions. Before your permission list grows and maintenance becomes an issue, this package offers simple way of defining roles and their permissions.

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

Usage

In a simple setup we usually have two basic parts of an RBAC: a permission and a role. Permissions are usually grouped by functional or business logic domain and a Role encapsulates them for a specific guard.

  1. Create Abilities
  2. Define Roles
  3. Connect the dots

Abilities

To avoid collision with spatie/laravel-permission we are going to use BackedEnum Ability enums to hold out enumerated permissions: You can read more on using enums as permissions at the official docs.

To create an Ability:

This will generate a PostAbility in App\Abilities:

Default stub contains fairly standard CRUD enumeration, generated using the name of the ability. Feel free to publish the stubs and adjsut as needed.

Defined Roles

As the name suggests, a DefinedRole offers a mechanism to simplify the definition of all permissions needed for a given role. To create an EditorRole run:

This will generate an EditorRole within App\Roles:

This class contains a (now testable!) configuration definition for the role and its web guard. Pretty neat! We can now adjust it like so:

Now you are confident a specific role has specific permissions!

Connect the dots

Now that we have the abilities and roles, simply register role with rbac.php config:

When you run rbac:reset next time, your RBAC will be reset automatically.

Integration

I suggest adding the script to post-autoload-dump of your composer.json to make sure the RBAC is reset on every composer dump:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Credits

License

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


All versions of laravel-rbac with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0
lorisleiva/laravel-actions Version ^2.8
spatie/laravel-collection-macros Version ^7.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-permission Version ^6.4
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 binary-cats/laravel-rbac contains the following files

Loading the files please wait ....