Download the PHP package denismitr/laravel-permissions without Composer

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

Version 2.1

Laravel Permissions

This is a package to integrate with Laravel 5.5 - 5.8

Installation

Require this package with composer:

After updating composer, add the PermissionsServiceProvider to the providers array in config/app.php like so:

Then if you need to use one of the provided middleware, you can add a auth.group middleware to your Http Kernel.php like so:

This one insures that user belongs to all required auth groups

Publish config and migrations

and pick Provider: Denismitr\Permissions\PermissionsServiceProvider from the list

Migration

Then run php artisan migrate and the following 5 tables will be created:

Creating the CRUD and populating these tables is up to you.

Usage

First include InteractsWithAuthGroups trait into the User model like so:

To add users to an AuthGroup and give them group permissions:

Check if auth group already exists

Private groups and/or teams

User can create private groups or basically teams. Note that there is a canOwnAuthGroups method on InteractsWithAuthGroups trait that returns true by default. If you want to define some custom rules on whether this or that user is allowed to create auth groups, which you probably do, you need to override that method in your user model.

Roles

roles are just strings and they are supposed to be used just as additional helpers.

To withdraw permissions

Grant permission through auth group:

To check for permissions:

Attention!!! for compatibility reasons the method can support only single ability argument

Current AuthGroup

User can have a current auth group, via a current_auth_group_id column that is being added to the users table by the package migrations. This feature can be used to emulate switching between teams for example.

Note that in case user belongs to one or more auth groups the currentAuthGroup() method will automatically choose and set one of the users auth group as current, persist it on User model via current_auth_group_id column and return it. The same applies to currentAuthGroupName().

Plus a bonus a blade authgroup and team directives:

And it's alias

Some other directives

Author

Denis Mitrofanov


All versions of laravel-permissions with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
illuminate/console Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/database Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/auth Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/container Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/contracts Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/events Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/support Version ~5.5.0|~5.6.0|~5.7.0|~5.8.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 denismitr/laravel-permissions contains the following files

Loading the files please wait ....