Best laravel framework open-source packages.

Laravel access rules

Simple system of ACR (Access Control Rules) for Laravel, with roles, groups, unlimited inheritance and possibility of multiplayer use.
Updated 3 months ago

Laravel Access Control Rules

Access Control Rules (Laravel Permissions Package)

License Code Climate PHP Version Require Total Downloads Latest Stable Version Latest Unstable Version

What does Access Control Rules support?

  • Multiple user models.
  • Multiple permissions can be attached to users.
  • Multiple permissions can be attached to groups.
  • Permissions verification.
  • Permissions caching.
  • Events when permissions are attached, detached or synced.
  • Multiple permissions can be attached to user or group.
  • Permissions can be inherited with unlimited investment from users and groups.
  • Laravel gates and policies.

Documentation, Installation, and Usage Instructions

See the documentation for detailed installation and usage instructions.

You can install the package using composer:

composer require wnikk/laravel-access-rules

See the installation page for detailed.

What It Does

This package allows you to manage user permissions and groups (instead roles) in a database.

Once installed you can do stuff like this:

use Wnikk\LaravelAccessRules\AccessRules;

// Add new rule permission
AccessRules::newRule('articles.edit', 'Access to editing articles');
// Adding permissions to a user
$user->addPermission('articles.edit');

Or you can inherit the rights from another user or groups

// According to the existing user from object
$user->inheritPermissionFrom(User::find(1));

// By identifier
$user->inheritPermissionFrom(User::class, 1);

// From the group
$user->inheritPermissionFrom('Group', 1);

Because all permissions will be registered on Laravel's gate, you can check if a user has a permission with Laravel's default can function:

$user->can('articles.edit');

Examples of how can be used in more detail described in Basic Usage section.

Opening an Issue

Before opening an issue there are a couple of considerations:

  • You are all awesome!
  • Pull requests are more than welcome.
  • Read the instructions and make sure all steps were followed correctly.
  • Check that the issue is not specific to your development environment setup.
  • Provide duplication steps.
  • Attempt to look into the issue, and if you have a solution, make a pull request.
  • Show that you have made an attempt to look into the issue.
  • Check to see if the issue you are reporting is a duplicate of a previous reported issue.
  • Following these instructions show me that you have tried.
  • Please be considerate that this is an open source project that I provide to the community for FREE when opening an issue.

Alternatives

License

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