Download the PHP package amir/laravel-permission without Composer

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

Laravel permission

An easy and flexible Laravel authorization and roles permission management

Why we need a Laravel permission package

In many projects, we need to implement a role-based permissions management system for our users. Although Laravel has the best tools to manage users' permissions, I build this package to make it simpler, more flexible, and to avoid duplicate work in many web projects built on Laravel.

How to use

The idea is to use this package as easy and as flexible as possible.
This package creates a list of all your routes and assigns these permissions list to user roles.
Although the laravel-permission package does most of the work, you could easily extend it and implement your authorization system.

Installation

Start with installing the package through the composer. Run this command in your terminal:

After that, you need to run the migration files:

How to authorize user

This package adds a role_id to the users table. Roles are stored in the roles table. You can assign a role to a user in your administrator panel or by creating a seed file.
Then, you only need to assign auth.role middleware to your routes.

Assign a route to a role

Besides middleware and other route settings, you can use a role key in your route groups to assign a role to your routes.
You can put your routes for a role in a Route group like this:

Of course, you can have as many as route groups like this.
Then you need to run this artisan command to register all permissions:

This command will register all permissions and assign permissions to the roles.
If you add a fresh option to this command, it will delete all data and generate fresh permissions data:


Now only users with the proper role can access the route assigned to them.
Don't forget that this package does not handle assigning roles to the users. You need to handle this in your administration panel or anywhere else you handle your users.
Again, if you want to add permissions to the routes manually it is not necessary to add role key in your route group. You can easily assign permissions to the roles in your administration panel or create another seed file for that.

How to create roles

The php artisan permissions:generate command will make all roles defined in the routes if they are not exist.
Also, You can create a seeder to fill the roles table. It takes only a name field.
Your RolesSeeser file can look like this.

Don't forget to import the Role model in your seeder.

How to clear permissions

To clear registered permissions you can run this command:

You can use this command to clear all permissions data for a specific role

To erase only permissions list, run permissions:clear command with this option:

To clear all roles:

To clear only permissions role relation:

This command erases all permissions assigned to roles, so you can regenerate permissions

Also, you can use these options in combination:

About

I used this Laravel permission management method in my projects for a while. It made manging Laravel permission easy and flexible for me. I hope it helps you as well. All pull requests are welcome.
Most of the work is based on my article about Laravel authorization and roles permission management


All versions of laravel-permission with dependencies

PHP Build Version
Package Version
No informations.
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 amir/laravel-permission contains the following files

Loading the files please wait ....